Skip to content
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

Width and Padding #34

Closed
d1231 opened this issue Mar 19, 2017 · 4 comments
Closed

Width and Padding #34

d1231 opened this issue Mar 19, 2017 · 4 comments

Comments

@d1231
Copy link

d1231 commented Mar 19, 2017

Hi,

I think I found issue in the calculations of boxs width.

In BlockBox.java line 2037, you get the content width:
content.width = dec.getLength(width, auto, 0, 0, contw);

That value includes the padding, so when using totalWidth in ElementBox.java line 814:
public int totalWidth() { return emargin.left + border.left + padding.left + content.width + padding.right + border.right + emargin.right; }

So the padding is calculated twice.

@d1231 d1231 changed the title Content width Width and Padding Mar 19, 2017
@radkovo
Copy link
Owner

radkovo commented Mar 19, 2017

To my best knowledge, content width should not include padding by default as long as you don't play with box-sizing which is unfortunately not supported by CSSBox yet. The code you mentioned has been tested quite well on many examples so I believe it's correct. However, if you have some example that demonstrates an error in CSSBox, I would be grateful if you could attach it.

@d1231
Copy link
Author

d1231 commented Mar 19, 2017

You're correct about the box-sizing.

The example I worked was similar to this one: https://jsfiddle.net/d1231/eoc1dprq/

Is there any timeline regarding the box-sizing feature?
Would you require any help?

Thanks

@radkovo
Copy link
Owner

radkovo commented Mar 29, 2017

I have added some experimental support for box-sizing to the master branch. It requires the git version of jStyleParser as well. For the first look it works but a thorough testing is necessary.

@d1231
Copy link
Author

d1231 commented Mar 30, 2017

Thanks. I will check it in the coming days

@radkovo radkovo closed this as completed Oct 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants