Skip to content

Commit

Permalink
Merge pull request #1424 from vivliostyle/fix/bug-at-break
Browse files Browse the repository at this point in the history
fix: prevent wrong break at beginning of paragraph
  • Loading branch information
MurakamiShinyu authored Nov 27, 2024
2 parents 6b4b67f + f58e457 commit 53a202e
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion packages/core/src/vivliostyle/layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,12 @@ export class Column extends VtreeImpl.Container implements Layout.Column {
);
frame
.loopWithFrame((bodyFrame) => {
if (position.viewNode && !LayoutHelper.isSpecialNodeContext(position)) {
if (
position.viewNode &&
!LayoutHelper.isSpecialNodeContext(position) &&
// Prevent breaking inside SVG etc. (Issue #1406)
position.viewNode.parentElement?.namespaceURI === Base.NS.XHTML
) {
checkPoints.push(position.copy());
}
this.maybePeelOff(position, 0).then((position1Param) => {
Expand Down Expand Up @@ -2008,6 +2013,15 @@ export class Column extends VtreeImpl.Container implements Layout.Column {
): Vtree.NodeContext {
const position = this.findEndOfLine(edgePosition, checkPoints, true);
let nodeContext = position.nodeContext;

if (
position.checkPointIndex === 0 &&
position.index === nodeContext.boxOffset
) {
// Prevent wrong break at beginning of paragraph (Issue #1401, #1406)
return null;
}

const viewNode = nodeContext.viewNode;
if (
viewNode.nodeType != 1 &&
Expand Down

0 comments on commit 53a202e

Please sign in to comment.