Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 8bf70588e2a902733a0e95f07571640bf1bb6e5b
      
https://github.com/WebKit/WebKit/commit/8bf70588e2a902733a0e95f07571640bf1bb6e5b
  Author: Nathan Solomon <[email protected]>
  Date:   2026-07-01 (Wed, 01 Jul 2026)

  Changed paths:
    A LayoutTests/fast/selectors/checked-subject-style-update-expected.txt
    A LayoutTests/fast/selectors/checked-subject-style-update.html
    M Source/WebCore/html/HTMLInputElement.cpp

  Log Message:
  -----------
  Remove invalidateStyle() call from HTMLInputElement::setChecked()
https://bugs.webkit.org/show_bug.cgi?id=318181
rdar://176048636

Reviewed by Antti Koivisto.

HTMLInputElement::setChecked updates an input element's checked state and
unconditionally calls invalidateStyle() that forces a full style
resolution of the input on every checked-state change. This explicit 
invalidateStyle() is not needed with the
PseudoClassChangeInvalidation already constructed at the top of the function, 
which invalidates
the elements whose style depends on :checked and does nothing when no :checked 
rule applies. The
invalidateStyle() adds only an unconditional self-invalidation, which produces 
no style change in the
case where the input matches no :checked rule. This is safe to remove because 
flipping the checked
bit can only change an element's computed style through :checked selector 
matching in SelectorChecker
when evaluating the :checked pseudo-class. Nowhere else in style resolution 
reads the checked state.
Before this change, if no :checked rule matches the input element, we were 
still doing style resolution,
but the resolved style was identical before vs after the toggle which wasted 
work.

The one checked state-dependent visual that isn't CSS is the painted checkmark, 
which setChecked()
already repaints via renderer->repaint() for native form controls,
so the painting of the checkmark does not depend on style invalidation either.

* LayoutTests/fast/selectors/checked-subject-style-update-expected.txt: Added.
* LayoutTests/fast/selectors/checked-subject-style-update.html: Added.
* Source/WebCore/html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setChecked):

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



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

Reply via email to