LibWeb::HTML: Fix cursor paint even if input html element is empty
Currently, when we focus on html input element in the browser, the cursor does not get drawn/shown. Since m_cursor_position->node()->paintable() returns nullptr if text content of input element is empty therefore we set m_cursor_position->node()->set_text_content to " ".
Bug:
https://github.com/SerenityOS/serenity/assets/15072510/cc4023f9-7058-459b-8d13-3fbf4cbb235c
Fix:
https://github.com/SerenityOS/serenity/assets/15072510/7935a411-dc1b-427e-b5df-41f9b1a7f4ab
Hello!
One or more of the commit messages in this PR do not match the SerenityOS code submission policy, please check the lint_commits CI job for more details on which commits were flagged and why.
Please do not close this PR and open another, instead modify your commit message(s) with git commit --amend and force push those changes to update this PR.
Your changes cause numerous test failures in the LibWeb tests. Please take a look locally, and ask on discord if you're not sure how to run the tests
==================================================
Pass: 911, Fail: 13, Skipped: 4, Timeout: 0
==================================================
Skipped: /home/vsts/work/1/s/Tests/LibWeb/Text/input/Worker/Worker-echo.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/input-commit.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/focus-contenteditable.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/HTML/form-implicit-submission.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/input-readonly.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/input-click-to-unfocus.html
Skipped: /home/vsts/work/1/s/Tests/LibWeb/Text/input/WebAnimations/animation-properties/playbackRate.html
Skipped: /home/vsts/work/1/s/Tests/LibWeb/Text/input/WebAnimations/animation-properties/startTime.html
Skipped: /home/vsts/work/1/s/Tests/LibWeb/Text/input/window-scrollTo.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/focus-events.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/textarea-readonly.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/Editing/execCommand-is-a-noop.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/Editing/input-into-empty-contenteditable.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/textarea-value.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/hit_testing/svg-path.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/input-blur.html
Fail: /home/vsts/work/1/s/Tests/LibWeb/Text/input/input-commit-on-unfocus.html
I don't think this is the right fix - setting the text content to " " doesn't seem right. I think you will want to look at the cursor painting code and work backwards to see why it isn't invoked for empty text nodes.
https://github.com/SerenityOS/serenity/blob/16f33aafdab9818d3c2a27143743e248518d7bc3/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp#L613
This pull request has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions!
This pull request has been closed because it has not had recent activity. Feel free to re-open if you wish to still contribute these changes. Thank you for your contributions!