date input positions incorrectly when using min-height
Categories
(Core :: Layout: Form Controls, defect)
Tracking
()
People
(Reporter: adampcooke, Assigned: emilio)
Details
Attachments
(5 files)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0
Steps to reproduce:
#div1 input {
min-height: 38px;
}
#div2 input {
height: 38px;
}
<div id='div1'>
<input type='text'/><input type='date'/>
</div>
<div id='div2'>
<input type='text'/><input type='date'/>
</div>
https://jsfiddle.net/2ozf63d4/2/
Actual results:
The position of inputs with a type='date' and a min-height behaves differently to text and number inputs or date inputs with height set instead of min-height.
date inputs with a min-height are offset down
Expected results:
inputs should be positioned the same
Comment 1•2 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Layout: Form Controls' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Reporter | ||
Comment 2•2 years ago
|
||
Possibly related to vertical alignment
Comment 3•2 years ago
|
||
Looks like the regression happened around here.
Maybe bug 1698606?
Comment 4•1 years ago
|
||
The severity field is not set for this bug.
:TYLin, could you have a look please?
For more information, please visit auto_nag documentation.
Comment 5•1 years ago
|
||
Comment 6•1 years ago
|
||
(In reply to David Shin[:dshin] from comment #3)
Looks like the regression happened around here.
Maybe bug 1698606?
bug 1698606 changes the baseline of date control. Maybe it's related.
Updated•1 years ago
|
Assignee | ||
Updated•1 years ago
|
Assignee | ||
Comment 9•1 years ago
|
||
Use inline initializers etc.
Updated•1 years ago
|
Assignee | ||
Comment 10•1 years ago
|
||
This seems to be here since nsTextControlFrame has a meaningful
baseline, but it doesn't make much sense to me:
- Baseline is a block axis, not inline axis measurement.
- It doesn't call into the base class which seems clearly a bug (though
the intrinsic isize of the input is ~fixed, doesn't depend on font
metrics, so it's probably ok).
My guess is that it was intended to be a debug-only check so that we
could detect stale baseline values.
Just remove this. If you think the check is useful we could keep this
but call the base class or something, but not convinced it's worth it.
Depends on D175744
Assignee | ||
Comment 11•1 years ago
|
||
This isn't needed for nsTextControlFrame because its ComputeAutoSize
implementation doesn't return an unconstrained line-height for inputs,
so we never end up in the UNCONSTRAINEDSIZE case, but it's needed for
date/time inputs.
Use GetLineHeight while at it, since it's the inflated line-height which
is what we want, and may be cached so we can avoid computing it.
Maybe in the future we can make date/time inputs just use
nsTextControlFrame, which would prevent this from happening in the
future.
Depends on D175745
Assignee | ||
Comment 12•1 years ago
|
||
Seems like this should be doable, and would avoid mistakes like this in
the future.
Assignee | ||
Updated•1 years ago
|
Comment 13•1 years ago
|
||
Comment 14•1 years ago
|
||
Comment 15•1 years ago
|
||
Comment 17•1 years ago
|
||
Comment 18•1 years ago
|
||
Comment 19•1 years ago
|
||
bugherder |
Assignee | ||
Updated•1 years ago
|
Comment 20•1 years ago
•
|
||
Backed out for causing wr failures on input-date-content-size.html.
LATER EDIT: there are also some wpt failures:
- PROCESS-CRASH | /html/semantics/forms/the-input-element/focus-dynamic-type-change.html | application crashed [@ libxul.so + 0x00000000068f447d]
- PROCESS-CRASH | /html/semantics/forms/the-input-element/focus-dynamic-type-change.html | application crashed [@ style::gecko::wrapper::GeckoNode::get_bool_flag]
- SUMMARY: ThreadSanitizer: SEGV /builds/worker/checkouts/gecko/servo/components/style/gecko/wrapper.rs:321:9 in style::gecko::wrapper::GeckoNode::get_bool_flag::h39d63b6be00000d1
Updated•1 years ago
|
Comment 21•1 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/4d22afc76172
https://hg.mozilla.org/mozilla-central/rev/dfc64b8c1591
https://hg.mozilla.org/mozilla-central/rev/662b4b7bac25
Assignee | ||
Comment 22•1 years ago
|
||
Ahh, the null crashes could be fixed like so:
diff --git a/layout/forms/nsTextControlFrame.cpp b/layout/forms/nsTextControlFrame.cpp
index b6233ee07c675..c92390d179df8 100644
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -565,7 +565,9 @@ void nsTextControlFrame::AppendAnonymousContentTo(
aElements.AppendElement(mRevealButton);
}
- aElements.AppendElement(mRootNode);
+ if (mRootNode) {
+ aElements.AppendElement(mRootNode);
+ }
}
nscoord nsTextControlFrame::GetPrefISize(gfxContext* aRenderingContext) {
But I don't have the cycles right now to investigate the other failure and I don't think it's important, the bug is fixed with the other changes.
Updated•1 years ago
|
Reproducible on a 2023-04-16 Nightly build on Windows 10.
Verified as fixed on Firefox 114.0b4(build ID: 20230514175823) and Nightly 115.0a1(build ID: 20230515215623) on Windows 10, macOS 12, Ubuntu 22.
Description
•