-
Notifications
You must be signed in to change notification settings - Fork 363
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
Replaced element improved sizing support #372
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This work moves sizing of replaced objects form externally in each replaced object implementation to internally in the core code. This should reduce duplication and mean all sizing properties are available on each replaced object type. For example, now images have min-width and min-height as well as a border-box implementation. This work is published initially in a new branch because while there are good tests for images we need to test the new sizing code for all the other replaced object options such as SVG, PDF, custom, etc.
Including min-width/min-height and border-box sizing. With test.
We can now use unit values such as mm in the width/height attribute of SVG images. With tests.
Now, always keep the correct aspect ratio.
The MathML renderer (JEuclid) produces slightly different results on JDK8 vs JDK11 so is not suitable for auto testing.
Only one broken test - svg linked with img tag.
…mg tag. This is mostly a revert of d9cdd6a I forgot about external SVGs rather than inline SVGs where the width/height attribute are converted to CSS earlier in the render process.
Nearly there, the only reason I havent committed the test is that it is a couple of pixels off on width, which is noticeable when there is a border.
Turns out the problem was prematurely casting our width and height to ints and thus getting incorrect scale factors. Test now passing.
I thought I had broken the clear mechanism, but it was fine. Left test as a useful regression test.
Hopefully this will also trigger travis.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This body of code, works on the the sizing of replaced elements including:
img
math
svg
Specifically it moves much of the sizing code into the core instead of each replaced element implementation having to provide their own sizing code.
Other improvements:
min-width
andmin-height
properties for above elements (max-width
andmax-height
were already implemented.img
tag -<img src="happy.pdf" alt="First page" page="1" />
NOTES:
Relevant wiki pages (need to be updated once this is released):
Comments welcome.
P.S. Trying to merge this and do a release within the next couple of days.