Skip to content

Commit

Permalink
fix: float margins collapsed wrongly
Browse files Browse the repository at this point in the history
- fix #1282
  • Loading branch information
MurakamiShinyu committed Feb 20, 2024
1 parent 8667886 commit 03121f2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/core/src/vivliostyle/vgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,10 @@ export class ViewFactory
elementStyle,
computedStyle,
);
if (floatReference && PageFloats.isPageFloat(floatReference)) {
// Fix page float margin collapsing issue (Issue #1282)
computedStyle["display"] = Css.ident.flow_root;
}
styler.processContent(
element,
computedStyle,
Expand Down Expand Up @@ -1624,6 +1628,10 @@ export class ViewFactory
return null;
}
}
if (nc.parent?.floatSide) {
// inside float, not break (Issue #1282)
return null;
}
const parentViewNode = nc.parent?.viewNode as Element;
if (parentViewNode) {
const style = this.viewport.window.getComputedStyle(parentViewNode);
Expand All @@ -1637,7 +1645,7 @@ export class ViewFactory
while (
node &&
(Vtree.canIgnore(node, nc.parent.whitespace) ||
LayoutHelper.isOutOfFlow(node))
(!nc.floatSide && LayoutHelper.isOutOfFlow(node)))
) {
node = node.nextSibling;
}
Expand Down

0 comments on commit 03121f2

Please sign in to comment.