-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toggling the spellcheck attribute on input elements doesn't toggle spelling markers #21637
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
EWS run on previous version of this PR (hash d8dbb3a) |
whsieh
approved these changes
Dec 11, 2023
EWS run on previous version of this PR (hash a49f1db) |
Thanks for the review! |
EWS run on current version of this PR (hash e1f0b02) |
β¦elling markers https://bugs.webkit.org/show_bug.cgi?id=265958 rdar://119269616 Reviewed by Wenson Hsieh. Add or remove spelling and grammar markers from <input> and <textarea> if the control has been focused at some point, and the spellcheck attribute is toggled. General `contenteditable` are currently excluded from this behavior, since storing additional information about whether an element has ever been focused would be expensive. Additionally, the behavior this patch implements matches Firefox exactly. * LayoutTests/editing/spelling/spellcheck-attribute-toggle-expected.html: Added. * LayoutTests/editing/spelling/spellcheck-attribute-toggle.html: Added. * Source/WebCore/dom/Document.h: (WebCore::Document::hasEverHadSelectionInsideTextFormControl const): (WebCore::Document::setHasEverHadSelectionInsideTextFormControl): Store a bit to indicate if a selection has ever been inside a text form control. Since spellchecking can only occur if a selection has been made, this serves to provide an optimization where changes to the spellcheck attribute do not perform unnecessary tree walks when the page is first loaded, before any editing commands have occured, and before a selection is made. * Source/WebCore/html/HTMLElement.cpp: (WebCore::HTMLElement::attributeChanged): (WebCore::HTMLElement::effectiveSpellcheckAttributeChanged): The effective value of the spellcheck attribute is determined by the nearest ancestor if the element itself does not have the attribute specified. Perform a descendant tree walk to find affected elements for a given attribute change. Note the optimization described earlier to avoid unnecessary tree walks. * Source/WebCore/html/HTMLElement.h: * Source/WebCore/html/HTMLTextFormControlElement.cpp: (WebCore::HTMLTextFormControlElement::selectionChanged): (WebCore::HTMLTextFormControlElement::effectiveSpellcheckAttributeChanged): Toggle markers only if the control has had a selection at some point. * Source/WebCore/html/HTMLTextFormControlElement.h: Canonical link: https://commits.webkit.org/271927@main
e1f0b02
to
971fabe
Compare
Committed 271927@main (971fabe): https://commits.webkit.org/271927@main Reviewed commits have been landed. Closing PR #21637 and removing active labels. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
971fabe
e1f0b02