Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d7e868645091021064481f64f61aef5fe28a43a4
      
https://github.com/WebKit/WebKit/commit/d7e868645091021064481f64f61aef5fe28a43a4
  Author: Brady Eidson <[email protected]>
  Date:   2026-03-05 (Thu, 05 Mar 2026)

  Changed paths:
    M Source/WebCore/dom/Element.cpp
    M Source/WebCore/dom/Element.h
    M Source/WebCore/dom/Node.h
    M Source/WebCore/rendering/RenderElement.cpp
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm

  Log Message:
  -----------
  Make 'hidden' attribute play nicely with TextManipulationController observing
rdar://169931473
https://bugs.webkit.org/show_bug.cgi?id=309226

Reviewed by Ryosuke Niwa.

When a TextManipulationController starts observing a Document, parts of the DOM 
that are not visible are skipped.
If they later become visible, they are then processed.

This is currently handled by the existence of a renderer. When an element 
without a renderer has something change
(such as its CSS "display" property) that causes a renderer to be created, the 
TextManipulationController is told.

However some elements can already have a renderer even though they will never 
display.
This is related to the HTML "hidden" attribute - which is entirely distinct 
from a hidden style - being removed.

Since they already have a renderer, the TextManipulationController was never 
told about a renderer being created,
and therefore their newfound visibility went unnoticed.

This patch adds explicit logic around this case. Whenever the `hidden` 
attribute on an `Element` changes, the
element is flagged for one-time special processing in style recalc so it can be 
passed to TextManipulationController.

Test: Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm

* Source/WebCore/dom/Element.cpp:
(WebCore::Element::shouldNotifyTextManipulationControllerIfDisplayed const):
(WebCore::Element::clearShouldNotifyTextManipulationControllerIfDisplayed):
(WebCore::Element::willModifyAttribute):
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/Node.h:
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::styleDidChange):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/TextManipulation.mm:
(TestWebKitAPI::TEST(TextManipulation, 
StartTextManipulationFindNewlyDisplayedParagraph)):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to