Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 0bd77658c08bee13c9ea7c67f48b65e30dac81e7
https://github.com/WebKit/WebKit/commit/0bd77658c08bee13c9ea7c67f48b65e30dac81e7
Author: Aditya Keerthi <[email protected]>
Date: 2025-06-30 (Mon, 30 Jun 2025)
Changed paths:
A
LayoutTests/fast/forms/number/number-min-max-spinbutton-appearance-none-percentage-width-expected.txt
A
LayoutTests/fast/forms/number/number-min-max-spinbutton-appearance-none-percentage-width.html
A
LayoutTests/platform/gtk/fast/forms/number/number-min-max-spinbutton-appearance-none-percentage-width-expected.txt
M LayoutTests/platform/ios/TestExpectations
M Source/WebCore/html/HTMLInputElement.cpp
M Source/WebCore/html/HTMLInputElement.h
M Source/WebCore/html/InputType.cpp
M Source/WebCore/html/InputType.h
M Source/WebCore/html/NumberInputType.cpp
M Source/WebCore/html/NumberInputType.h
M Source/WebCore/html/SearchInputType.cpp
M Source/WebCore/html/SearchInputType.h
M Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Log Message:
-----------
Intrinsic size of number inputs is incorrect when spin button width is a
percentage value
https://bugs.webkit.org/show_bug.cgi?id=294877
rdar://154680747
Reviewed by Abrar Rahman Protyasha.
Percentage values for spin button width are currently treated as pixel values
when
determining the intrinsic size of a number input.
Fix by effectively resolving the percentage against the intrinsic width without
the button, and then increasing the overall width accordingly. The algorithm
used
matches Chromium.
*
LayoutTests/fast/forms/number/number-min-max-spinbutton-appearance-none-percentage-width-expected.txt:
Added.
*
LayoutTests/fast/forms/number/number-min-max-spinbutton-appearance-none-percentage-width.html:
Added.
*
LayoutTests/platform/gtk/fast/forms/number/number-min-max-spinbutton-appearance-none-percentage-width-expected.txt:
Added.
GTK has a different default font (and character width) from macOS.
* LayoutTests/platform/ios/TestExpectations:
Spin buttons are not present on iOS.
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::decorationWidth const):
* Source/WebCore/html/HTMLInputElement.h:
Pass in the input width without the button so that there is a size to resolve
the percentage against.
* Source/WebCore/html/InputType.cpp:
(WebCore::InputType::decorationWidth const):
* Source/WebCore/html/InputType.h:
* Source/WebCore/html/NumberInputType.cpp:
(WebCore::NumberInputType::decorationWidth const):
The additional width is computed as:
`inputWidth * percentageWidthOfSpinButton / (100 - percentageWidthOfSpinButton)`
This matches Chromium.
* Source/WebCore/html/NumberInputType.h:
* Source/WebCore/html/SearchInputType.cpp:
(WebCore::SearchInputType::decorationWidth const):
* Source/WebCore/html/SearchInputType.h:
* Source/WebCore/rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::preferredContentLogicalWidth const):
Canonical link: https://commits.webkit.org/296850@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes