Bug 207328

Summary: Search cancel button becomes visible when there's a hover effect in CSS
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: aperez, cdumez, dbates, esprehn+autocc, ews-watchlist, gyuyoung.kim, koivisto, mifenton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=207379
Attachments:
Description Flags
Test case
none
WIP: update the style when a new renderer is created
none
Patch
none
Patch aperez: review+

Description Carlos Garcia Campos 2020-02-06 05:27:45 PST
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.
Comment 1 Carlos Garcia Campos 2020-02-06 06:41:36 PST
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.
Comment 2 Carlos Garcia Campos 2020-02-07 02:08:02 PST
Created attachment 390068 [details]
Patch
Comment 3 Carlos Garcia Campos 2020-02-10 00:26:50 PST
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.
Comment 4 Carlos Garcia Campos 2020-02-10 01:50:34 PST
Ah, I always forget iOS doesn't support eventSender.mouseDown/Up/MoveTo, I'll just skip this test in iOS.
Comment 5 Carlos Garcia Campos 2020-02-10 07:05:45 PST
Created attachment 390249 [details]
Patch
Comment 6 Carlos Garcia Campos 2020-02-17 01:37:22 PST
Committed r256725: <https://trac.webkit.org/changeset/256725>
Comment 7 Radar WebKit Bug Importer 2020-02-17 01:38:14 PST
<rdar://problem/59504132>