Skip to content
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

REGRESSION(253764@main): Disconnecting a subtree makes :lang pseudo class to never match #3764

Merged
merged 1 commit into from Aug 29, 2022

Conversation

rniwa
Copy link
Member

@rniwa rniwa commented Aug 29, 2022

06479a2

REGRESSION(253764@main): Disconnecting a subtree makes :lang pseudo class to never match
https://bugs.webkit.org/show_bug.cgi?id=244484

Reviewed by Antti Koivisto.

The bug was caused by removedFromAncestor always clearing the effective lang in ElementRareData
when the element itself doesn't have a lang content attribute specified. This is wrong; We need
to keep the effective lang when an ancestor of "this" element still has a lang content attribute.

This patch also fixes a bug in insertedIntoAncestor that the code to inherit the effective lang
from a parent node was not running when the subtree is not inside a document or a shadow root.
To this end, insertedIntoAncestor has been refactored to match the structure of removedFromAncestor.

Finally, this patch also removes the code in insertedIntoAncestor which was trying to clear
the effective lang when "this" element doesn't have a lang attribute. This is also clearly wrong
as any ancestor with a valid lang attribute should continue to apply the same effective lang.

* LayoutTests/fast/css/lang-pseudo-disconnected-expected.txt: Added.
* LayoutTests/fast/css/lang-pseudo-disconnected.html: Added.
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::insertedIntoAncestor):
(WebCore::Element::removedFromAncestor):

Canonical link: https://commits.webkit.org/253915@main

225e389

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-gtk
βœ… πŸ›  tv βœ… πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2
βœ… πŸ›  watch βœ… πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  πŸ§ͺ unsafe-merge βœ… πŸ›  watch-sim βœ… πŸ§ͺ mac-wk2-stress

@rniwa rniwa requested a review from cdumez as a code owner August 29, 2022 08:54
@rniwa rniwa self-assigned this Aug 29, 2022
@rniwa rniwa added CSS Cascading Style Sheets implementation WebKit Nightly Build labels Aug 29, 2022
@rniwa rniwa requested a review from anttijk August 29, 2022 08:54
@rniwa rniwa force-pushed the fix244484 branch 2 times, most recently from 4121e71 to 225e389 Compare August 29, 2022 09:29
@rniwa rniwa added the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Aug 29, 2022
…lass to never match

https://bugs.webkit.org/show_bug.cgi?id=244484

Reviewed by Antti Koivisto.

The bug was caused by removedFromAncestor always clearing the effective lang in ElementRareData
when the element itself doesn't have a lang content attribute specified. This is wrong; We need
to keep the effective lang when an ancestor of "this" element still has a lang content attribute.

This patch also fixes a bug in insertedIntoAncestor that the code to inherit the effective lang
from a parent node was not running when the subtree is not inside a document or a shadow root.
To this end, insertedIntoAncestor has been refactored to match the structure of removedFromAncestor.

Finally, this patch also removes the code in insertedIntoAncestor which was trying to clear
the effective lang when "this" element doesn't have a lang attribute. This is also clearly wrong
as any ancestor with a valid lang attribute should continue to apply the same effective lang.

* LayoutTests/fast/css/lang-pseudo-disconnected-expected.txt: Added.
* LayoutTests/fast/css/lang-pseudo-disconnected.html: Added.
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::insertedIntoAncestor):
(WebCore::Element::removedFromAncestor):

Canonical link: https://commits.webkit.org/253915@main
@webkit-commit-queue
Copy link
Collaborator

Committed 253915@main (06479a2): https://commits.webkit.org/253915@main

Reviewed commits have been landed. Closing PR #3764 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 06479a2 into WebKit:main Aug 29, 2022
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Aug 29, 2022
@rniwa rniwa deleted the fix244484 branch August 29, 2022 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CSS Cascading Style Sheets implementation
Projects
None yet
4 participants