Commit 8bdd6ac7 authored by Fred Chasen's avatar Fred Chasen

Fix breakInside issues

parent d2611baa
Pipeline #72 passed with stage
in 2 minutes and 52 seconds
......@@ -83,10 +83,6 @@ onAtPage(atPageNode)
onRule(ruleNode)
onDeclaration(declarationNode, ruleNode)
onContent(contentNode, declarationNode, ruleNode)
// Previewer
beforePolishing(stylesheets)
beforeChunking(contents)
```
## Setup
......
......@@ -221,11 +221,7 @@ class Layout {
let offset = overflow.startOffset;
let node, renderedNode, ref, parent, index, temp, startOffset;
let parentBreak = this.avoidBreakInside(container, rendered);
if (parentBreak) {
node = parentBreak;
offset = 0;
} else if (isElement(container)) {
if (isElement(container)) {
temp = child(container, offset);
if (isElement(temp)) {
......@@ -240,17 +236,16 @@ class Layout {
node = findElement(renderedNode, source);
offset = 0;
} else {
console.error("Non-element found for breakToken", temp);
// renderedNode = findElement(container, rendered);
//
// if (!renderedNode) {
// renderedNode = findElement(prevValidNode(container), rendered);
// }
//
// parent = findElement(renderedNode, source);
// index = indexOf(temp);
// node = child(parent, index);
// offset = 0;
renderedNode = findElement(container, rendered);
if (!renderedNode) {
renderedNode = findElement(prevValidNode(container), rendered);
}
parent = findElement(renderedNode, source);
index = indexOf(temp);
node = child(parent, index);
offset = 0;
}
} else {
renderedNode = findElement(container.parentNode, rendered);
......
......@@ -128,20 +128,16 @@ class Previewer {
let handlers = this.initializeHandlers();
await this.hooks.beforePolishing.trigger(stylesheets, this);
let styleText = await this.polisher.add(...stylesheets);
let startTime = performance.now();
await this.hooks.beforeChunking.trigger(content, this);
// Render flow
let flow = await this.chunker.flow(content, renderTo);
let endTime = performance.now();
let msg = "Rendering " + flow.total + " pages took " + (endTime - startTime) + " milliseconds.";
console.log(msg);
this.emit("rendered", msg, this.size.width && this.size.width.value + this.size.width.unit, this.size.height && this.size.height.value + this.size.height.unit, this.size.orientation, this.size.format);
if (typeof window.onPagesRendered !== "undefined") {
window.onPagesRendered(msg, this.size.width && this.size.width.value + this.size.width.unit, this.size.height && this.size.height.value + this.size.height.unit, this.size.orientation, this.size.format);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment