Skip to content

Commit

Permalink
Remove hspace and vspace attributes from input field
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=244279
rdar://99356718

Reviewed by Antti Koivisto.

Removes hspace and vspace attribute mapping to CSS, but keeps it
in the case of input of type=image as mandated by the WPT test in
http://wpt.live/html/rendering/unmapped-attributes.html
but still passing
http://wpt.live/html/rendering/dimension-attributes.html

* LayoutTests/imported/w3c/web-platform-tests/html/rendering/unmapped-attributes-expected.txt:
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::collectPresentationalHintsForAttribute):

Canonical link: https://commits.webkit.org/258360@main
  • Loading branch information
karlcow authored and graouts committed Dec 30, 2022
1 parent 7c824e9 commit 9065879
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
Expand Up @@ -54,12 +54,12 @@ PASS <input width> should not be mapped to style width in CSS1Compat mode
PASS <input width> should not be mapped to style width in BackCompat mode
PASS <input height> should not be mapped to style height in CSS1Compat mode
PASS <input height> should not be mapped to style height in BackCompat mode
FAIL <input hspace> should not be mapped to style marginLeft in CSS1Compat mode assert_equals: expected "0px" but got "200px"
FAIL <input hspace> should not be mapped to style marginLeft in BackCompat mode assert_equals: expected "0px" but got "200px"
FAIL <input hspace> should not be mapped to style marginRight in CSS1Compat mode assert_equals: expected "0px" but got "200px"
FAIL <input hspace> should not be mapped to style marginRight in BackCompat mode assert_equals: expected "0px" but got "200px"
FAIL <input vspace> should not be mapped to style marginTop in CSS1Compat mode assert_equals: expected "0px" but got "200px"
FAIL <input vspace> should not be mapped to style marginTop in BackCompat mode assert_equals: expected "0px" but got "200px"
FAIL <input vspace> should not be mapped to style marginBottom in CSS1Compat mode assert_equals: expected "0px" but got "200px"
FAIL <input vspace> should not be mapped to style marginBottom in BackCompat mode assert_equals: expected "0px" but got "200px"
PASS <input hspace> should not be mapped to style marginLeft in CSS1Compat mode
PASS <input hspace> should not be mapped to style marginLeft in BackCompat mode
PASS <input hspace> should not be mapped to style marginRight in CSS1Compat mode
PASS <input hspace> should not be mapped to style marginRight in BackCompat mode
PASS <input vspace> should not be mapped to style marginTop in CSS1Compat mode
PASS <input vspace> should not be mapped to style marginTop in BackCompat mode
PASS <input vspace> should not be mapped to style marginBottom in CSS1Compat mode
PASS <input vspace> should not be mapped to style marginBottom in BackCompat mode

8 changes: 6 additions & 2 deletions Source/WebCore/html/HTMLInputElement.cpp
Expand Up @@ -677,11 +677,15 @@ bool HTMLInputElement::hasPresentationalHintsForAttribute(const QualifiedName& n
void HTMLInputElement::collectPresentationalHintsForAttribute(const QualifiedName& name, const AtomString& value, MutableStyleProperties& style)
{
if (name == vspaceAttr) {
addHTMLLengthToStyle(style, CSSPropertyMarginTop, value);
addHTMLLengthToStyle(style, CSSPropertyMarginBottom, value);
if (isImageButton()) {
addHTMLLengthToStyle(style, CSSPropertyMarginTop, value);
addHTMLLengthToStyle(style, CSSPropertyMarginBottom, value);
}
} else if (name == hspaceAttr) {
if (isImageButton()) {
addHTMLLengthToStyle(style, CSSPropertyMarginLeft, value);
addHTMLLengthToStyle(style, CSSPropertyMarginRight, value);
}
} else if (name == alignAttr) {
if (m_inputType->shouldRespectAlignAttribute())
applyAlignmentAttributeToStyle(value, style);
Expand Down

0 comments on commit 9065879

Please sign in to comment.