-
Notifications
You must be signed in to change notification settings - Fork 76
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
Update Layout without creating from scratch #67
Comments
CSSBox was originally designed primarily for one-time rendering so that page re-rendering was actually never thoroughly tested. But in theory, for re-rendering the page, the following approach should work: Viewport viewport = engine.getViewport();
viewport.doLayout(canvasWidth, true, true); // canvasWidth is the new canvas width
viewport.absolutePositions(); // re-compute absolute positions of sub-boxes Similarly, a subtree rooted with a BlockBox can be theoretically recomputed like this: BloxBox root = ... // the subtree root block box
root.doLayout(root.getAvailableContentWidth(), true, true);
root.absolutePositions() The size of the root block itself is not recomputed. Therefore, if some element changes, I would do this for its containing block (nearest block ancestor). |
Thanks a lot I will try |
@radkovo Doesn't work for me. Is the root returned by DOMAnalyzer a temporary/copy representation and not the original that gets rendered? Because I modified it and tried to re-render, but the changes were not shown. Also another question. I assume there is no support for animations then? Or animations based on input, like a mouse hover for example? Here is the code I am working with: https://github.com/Osiris-Team/Desku/blob/ccsbox/src/test/java/com/osiris/desku/cssbox/CssBoxTest.java |
Hi,
There is a way to update layout (recalculate boxes position/size when viewport is resized for example), without creating layout from scratch? Usually CSS styles and fonts doesn't change, so (for example) creating a VisualContext every time size is changed it seems a little expensive for me.
Another question related to this one: could I recalculate only a "part" of document tree? Just a subtree for example?
Thanks
The text was updated successfully, but these errors were encountered: