Bug 251904 - EffectiveLang optimization fails when document element is replaced
Summary: EffectiveLang optimization fails when document element is replaced
Status: RESOLVED DUPLICATE of bug 251657
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
: 251921 (view as bug list)
Depends on:
Blocks:
 
Reported: 2023-02-07 22:22 PST by Cameron McCormack (:heycam)
Modified: 2023-02-08 12:07 PST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack (:heycam) 2023-02-07 22:22:57 PST
If the document element has a lang attribute and it is removed from its parent document node, we can hit the assertion in Element::updateEffectiveLangStateFromParent that checks we don't have a lang attribute.  This is because Element::removedFromAncestor checks that the element doesn't have effective lang state before calling updateEffectiveLangStateFromParent(), with the understanding that "no effective lang state" means the element is in the common case of inheriting the document element lang state directly, i.e. there's no intervening ancestor with a lang attribute at all.

Additionally, we don't correctly handle updating the document element language when the document element is removed or replaced.  (We only update the document element language when the lang attribute on a current document element is changed.)
Comment 1 Radar WebKit Bug Importer 2023-02-07 22:23:15 PST
<rdar://problem/105163308>
Comment 2 Cameron McCormack (:heycam) 2023-02-08 11:52:23 PST
*** Bug 251921 has been marked as a duplicate of this bug. ***
Comment 3 Cameron McCormack (:heycam) 2023-02-08 12:06:13 PST
Original patch in bug 251657 was reverted. I'll use this bug to re-land with these fixes folded in.
Comment 4 Cameron McCormack (:heycam) 2023-02-08 12:07:07 PST
Actually I can use the original bug.

*** This bug has been marked as a duplicate of bug 251657 ***