Bug 207328 - Search cancel button becomes visible when there's a hover effect in CSS
Summary: Search cancel button becomes visible when there's a hover effect in CSS
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: CSS (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-02-06 05:27 PST by Carlos Garcia Campos
Modified: 2020-02-17 01:38 PST (History)
9 users (show)

See Also:


Attachments
Test case (410 bytes, text/html)
2020-02-06 05:27 PST, Carlos Garcia Campos
no flags Details
WIP: update the style when a new renderer is created (1.60 KB, patch)
2020-02-06 06:41 PST, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Patch (5.58 KB, patch)
2020-02-07 02:08 PST, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff
Patch (6.25 KB, patch)
2020-02-10 07:05 PST, Carlos Garcia Campos
aperez: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>