Created attachment 389942 [details] Test case See the attached test case. To reproduce: 1. Click on the search cancel button to clear the text. The button is now hidden 2. Move the mouse and the button is visible again Clicking again in the search field, or any other part of the document makes the button hide permanently. So, when the search field value is emptied the button visibility is correctly set to hidden in RenderSearchField::updateCancelButtonVisibility(), but as soon as the mouse is moved, the style visibility is changed to visible again (I couldn't find where). If we remove the hover effect from the style then the button is correctly hidden, so it has to do with that somehow.
Created attachment 389949 [details] WIP: update the style when a new renderer is created It's the render tree updater that creates a new renderer for the search cancel button element in RenderTreeUpdater::updateRenderTree(). In that case, the input element doesn't know about it and RenderSearchField::updateCancelButtonVisibility() is not called. This patch fixes the problem by updating the style when the new renderer is created. I'll try to convert the attached test case into a proper layout test.
Created attachment 390068 [details] Patch
hmm, the test doesn't pass in iOS for some reason. I will need some help there, I don't have a way to test in iOS.
Ah, I always forget iOS doesn't support eventSender.mouseDown/Up/MoveTo, I'll just skip this test in iOS.
Created attachment 390249 [details] Patch
Committed r256725: <https://trac.webkit.org/changeset/256725>
<rdar://problem/59504132>