haikuwebkit/LayoutTests/fast/forms/search-field-buttons-do-not...

52 lines
2.1 KiB
HTML
Raw Permalink Normal View History

REGRESSION (r263253): Search field results and cancel buttons have their own focus rings https://bugs.webkit.org/show_bug.cgi?id=213413 <rdar://problem/64548419> Reviewed by Tim Horton. Source/WebCore: After r263253, `paintCellAndSetFocusedElementNeedsRepaintIfNecessary` is used when painting the buttons in a search field's shadow root. However, the renderer that is passed in (which is used to determine whether we should additionally draw focus rings) is the input element's renderer rather than the renderers of the results and cancel buttons themselves. This means that when the search field is focused, we will draw focus rings around each of the buttons in the shadow root as well. Address this by using `box` (the buttons' RenderBoxes) instead. Test: fast/forms/search-field-buttons-do-not-have-focus-rings.html * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintSearchFieldCancelButton): (WebCore::RenderThemeMac::paintSearchFieldResultsButton): LayoutTests: Add a ref test to verify that the search and cancel buttons don't draw individual focus rings. This test works by verifying that no focus ring around either the cancel or results button bleeds outside of the bounds of a div that obscures the buttons. * fast/forms/search-field-buttons-do-not-have-focus-rings-expected.html: Added. * fast/forms/search-field-buttons-do-not-have-focus-rings.html: Added. Canonical link: https://commits.webkit.org/226209@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263303 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-20 00:43:39 +00:00
<!DOCTYPE html>
<html>
<head>
<style>
input[type="search"]::-webkit-search-results-button, input[type="search"]::-webkit-search-cancel-button {
opacity: 0;
}
input[type="search"] {
font-size: 16px;
position: absolute;
top: 0;
left: 0;
-webkit-appearance: none;
}
div {
position: absolute;
background-color: white;
}
p {
margin-top: 100px;
REGRESSION (r263253): Search field results and cancel buttons have their own focus rings https://bugs.webkit.org/show_bug.cgi?id=213413 <rdar://problem/64548419> Reviewed by Tim Horton. Source/WebCore: After r263253, `paintCellAndSetFocusedElementNeedsRepaintIfNecessary` is used when painting the buttons in a search field's shadow root. However, the renderer that is passed in (which is used to determine whether we should additionally draw focus rings) is the input element's renderer rather than the renderers of the results and cancel buttons themselves. This means that when the search field is focused, we will draw focus rings around each of the buttons in the shadow root as well. Address this by using `box` (the buttons' RenderBoxes) instead. Test: fast/forms/search-field-buttons-do-not-have-focus-rings.html * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintSearchFieldCancelButton): (WebCore::RenderThemeMac::paintSearchFieldResultsButton): LayoutTests: Add a ref test to verify that the search and cancel buttons don't draw individual focus rings. This test works by verifying that no focus ring around either the cancel or results button bleeds outside of the bounds of a div that obscures the buttons. * fast/forms/search-field-buttons-do-not-have-focus-rings-expected.html: Added. * fast/forms/search-field-buttons-do-not-have-focus-rings.html: Added. Canonical link: https://commits.webkit.org/226209@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263303 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-20 00:43:39 +00:00
}
</style>
</head>
<body>
<input type="search" results="5" value="foo" autofocus></input>
<div id="cover-results"></div>
<div id="cover-cancel"></div>
<p>This test verifies that the search and results buttons in a search field do not each draw their own focus rings. This test must be run under WebKitTestRunner or DumpRenderTree.</p>
<script>
if (window.internals) {
const search = document.querySelector("input[type=search]");
const coverCancel = document.querySelector("#cover-cancel");
const cancelButtonBounds = internals.shadowRoot(search).querySelector("div[pseudo='-webkit-search-cancel-button']").getBoundingClientRect();
coverCancel.style.left = `${Math.round(cancelButtonBounds.left) - 1}px`;
coverCancel.style.top = `${Math.round(cancelButtonBounds.top) - 1}px`;
coverCancel.style.width = `${Math.round(cancelButtonBounds.width) + 2}px`;
coverCancel.style.height = `${Math.round(cancelButtonBounds.height) + 2}px`;
const coverResults = document.querySelector("#cover-results");
const resultsButtonBounds = internals.shadowRoot(search).querySelector("div[pseudo='-webkit-search-results-button']").getBoundingClientRect();
coverResults.style.left = `${Math.round(resultsButtonBounds.left) - 1}px`;
coverResults.style.top = `${Math.round(resultsButtonBounds.top) - 1}px`;
coverResults.style.width = `${Math.round(resultsButtonBounds.width) + 2}px`;
coverResults.style.height = `${Math.round(resultsButtonBounds.height) + 2}px`;
}
</script>
REGRESSION (r263253): Search field results and cancel buttons have their own focus rings https://bugs.webkit.org/show_bug.cgi?id=213413 <rdar://problem/64548419> Reviewed by Tim Horton. Source/WebCore: After r263253, `paintCellAndSetFocusedElementNeedsRepaintIfNecessary` is used when painting the buttons in a search field's shadow root. However, the renderer that is passed in (which is used to determine whether we should additionally draw focus rings) is the input element's renderer rather than the renderers of the results and cancel buttons themselves. This means that when the search field is focused, we will draw focus rings around each of the buttons in the shadow root as well. Address this by using `box` (the buttons' RenderBoxes) instead. Test: fast/forms/search-field-buttons-do-not-have-focus-rings.html * rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::paintSearchFieldCancelButton): (WebCore::RenderThemeMac::paintSearchFieldResultsButton): LayoutTests: Add a ref test to verify that the search and cancel buttons don't draw individual focus rings. This test works by verifying that no focus ring around either the cancel or results button bleeds outside of the bounds of a div that obscures the buttons. * fast/forms/search-field-buttons-do-not-have-focus-rings-expected.html: Added. * fast/forms/search-field-buttons-do-not-have-focus-rings.html: Added. Canonical link: https://commits.webkit.org/226209@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@263303 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-06-20 00:43:39 +00:00
</body>
</html>