Skip to content

Commit

Permalink
fix: text-spacing-trim:space-first not working properly in some case
Browse files Browse the repository at this point in the history
- fix #1261
  • Loading branch information
MurakamiShinyu committed Feb 5, 2024
1 parent e545f40 commit 398b53e
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions packages/core/src/vivliostyle/text-polyfill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,16 +446,21 @@ class TextSpacingPolyfill {

function checkIfFirstInBlock(): boolean {
const p = checkPoints[0];
let viewNode = p.viewNode;
let parent = p.parent;
while (parent && parent.inline) {
parent = parent.parent;
for (let pp = p; ; pp = pp.parent) {
if (!pp || !pp.inline) {
if (pp?.fragmentIndex !== 1) {
// This block is not the first fragment
return false;
}
break;
}
}
if (parent?.fragmentIndex !== 1) {
return false;
if (!p.inline) {
// This is at the start of the block
return true;
}
for (
let prev = viewNode.previousSibling;
let prev = p.viewNode.previousSibling;
prev;
prev = prev.previousSibling
) {
Expand Down

0 comments on commit 398b53e

Please sign in to comment.