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
<input type=text> does not size itself properly with respect to character width #4378
Comments
This issue has gotten worse since originally posting: first input "90" overflows, second input "890" overflows. |
The width of the input is calculated here: |
My initial guess is that we want another argument for |
There's a value: |
Yes, that's the problem I was trying to resolve, too. The code in style/ doesn't have any knowledge of actual fonts or metrics, and it would be best to find ways to inject specific values from outside into it. |
For what it's worth, the code that initiates style recalculation for nodes is http://mxr.mozilla.org/servo/source/components/layout/traversal.rs#130 and the |
The relevant code there is the node.cascade_node, which propagates style information down through the children and computes sizes. |
Ok, what do you think, passing the LayoutContext down the cascade functions? |
That seems like an unlikely solution, not least because the layout crate depends on the style crate, and LayoutContext is defined in the layout crate. Maybe we want a special CascadeContext for things like this. |
That being said, it would be important to figure out if the FontContext in LayoutContext is even meaningful at the point that the cascade occurs. |
@SimonSapin might have ideas here, since a similar thing came up on IRC: http://logs.glob.uno/?c=mozilla%23servo#c172155 |
It makes sense for libstyle to know about font metrics (though maybe not all of |
This descision/refactoring seems to go beyond my capabilities as a newbie. |
Yeah, we probably need to define a computed-style-specific structure in libstyle that layout could use. |
Test case:
The value of both inputs should fit, but in the first example "0" overflows, and in the second one, "90" overflows.
The text was updated successfully, but these errors were encountered: