Skip to content

Migrate sticky and history-action user activation to explicit boolean flags - #66459

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
kate-k-lee:eng/Migrate-user-activation-to-boolean-flags
Jun 22, 2026
Merged

Migrate sticky and history-action user activation to explicit boolean flags#66459
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
kate-k-lee:eng/Migrate-user-activation-to-boolean-flags

Conversation

@kate-k-lee

@kate-k-lee kate-k-lee commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

a96f40e

Migrate sticky and history-action user activation to explicit boolean flags
https://bugs.webkit.org/show_bug.cgi?id=316317

Reviewed by Youenn Fablet.

Per the user-activation data model change in the proposed
whatwg/html#11454, track sticky activation and history-action activation
as explicit booleans on LocalDOMWindow instead of deriving them from the
last activation timestamp. m_lastActivationTimestamp continues to drive
transient activation only.

notifyActivated and its ancestor/descendant propagation, consume-history-
action, and WebPage::updateUserActivationTimestamps now update the
booleans alongside the timestamp. This is not gated behind a preference.
Behavior is preserved, except that consuming transient activation no
longer resurrects an already-consumed history-action activation, which
matches the proposed explicit boolean model.

* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::hasStickyActivation const):
(WebCore::LocalDOMWindow::hasHistoryActionActivation const):
(WebCore::LocalDOMWindow::consumeHistoryActionUserActivation):
(WebCore::LocalDOMWindow::notifyActivated):
* Source/WebCore/page/LocalDOMWindow.h:
(WebCore::LocalDOMWindow::setHasStickyActivation):
(WebCore::LocalDOMWindow::setHasHistoryActionActivation):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didNotifyUserActivation):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateUserActivationState):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:

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

d2874f9

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ❌ 🧪 win-tests
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug ✅ 🛠 gtk3-libwebrtc
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-AS-debug-wk2 ✅ 🧪 gtk-wk2
✅ 🛠 vision ✅ 🧪 api-gtk
✅ 🛠 vision-sim ✅ 🧪 mac-intel-wk2 ✅ 🛠 playstation
✅ 🛠 🧪 unsafe-merge ✅ 🧪 vision-wk2 ✅ 🛠 mac-safer-cpp
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

@kate-k-lee
kate-k-lee requested a review from cdumez as a code owner June 4, 2026 17:42
@kate-k-lee kate-k-lee self-assigned this Jun 4, 2026
@kate-k-lee kate-k-lee added the DOM For bugs specific to XML/HTML DOM elements (including parsing). label Jun 4, 2026
@kate-k-lee
kate-k-lee force-pushed the eng/Migrate-user-activation-to-boolean-flags branch from 05222b5 to d1898cf Compare June 4, 2026 18:17
@kate-k-lee
kate-k-lee requested a review from annevk June 4, 2026 18:17
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Jun 4, 2026
@kate-k-lee kate-k-lee removed the merging-blocked Applied to prevent a change from being merged label Jun 5, 2026
@kate-k-lee
kate-k-lee force-pushed the eng/Migrate-user-activation-to-boolean-flags branch from d1898cf to d1ae363 Compare June 5, 2026 14:31
@kate-k-lee
kate-k-lee force-pushed the eng/Migrate-user-activation-to-boolean-flags branch from d1ae363 to d5ade5f Compare June 8, 2026 02:51
@kate-k-lee
kate-k-lee force-pushed the eng/Migrate-user-activation-to-boolean-flags branch from d5ade5f to 697c44d Compare June 8, 2026 06:07
@kate-k-lee
kate-k-lee requested a review from youennf June 8, 2026 14:12
@kate-k-lee

Copy link
Copy Markdown
Contributor Author

@youennf

Hi, Anne suggested you might be a good person to review this, as you're more familiar with this area of the code. Would you mind taking a look when you have a chance?

This PR implements just the user-activation data-model change from whatwg/html#11454 (https://github.com/whatwg/html/pull/11454/changes) — migrating sticky and history-action activation from timestamp-derived state to explicit boolean flags on LocalDOMWindow. It's behavior-preserving and not gated. I'd like to land this refactor first, before the actual "preserve sticky activation" feature, which is in a separate PR (#63952).

Note: the CI site-isolation timeouts are unrelated — the changed code only runs on an actual user activation and is behavior-preserving, and the failing tests trigger no activation (they also reproduce on unrelated commits, so they're pre-existing on the base).

Thanks so much! 🙏

if (RefPtr window = localFrame->window()) {
window->setLastActivationTimestamp(activationTime);
window->setHasStickyActivation(true);
window->setHasHistoryActionActivation(true);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would tend to introduce a routine that updates both time and the two booleans in a single method.
How about something like updateActivation(MonotonicTime)?

// https://html.spec.whatwg.org/multipage/interaction.html#sticky-activation
// The published spec still derives sticky activation from the last activation
// timestamp; we track it as an explicit boolean per the proposed
// whatwg/html#11454 (https://github.com/whatwg/html/pull/11454).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be slightly better to wait for the PR to get merged.

Comment thread Source/WebCore/page/LocalDOMWindow.h Outdated
MonotonicTime m_lastActivationTimestamp { MonotonicTime::infinity() };
MonotonicTime m_lastHistoryActionActivationTimestamp { MonotonicTime::infinity() };
bool m_hasStickyActivation { false };
bool m_hasHistoryActionActivation { false };

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could move these bools just after m_lastUserClickEvent so that they are next to other bools.

@kate-k-lee
kate-k-lee force-pushed the eng/Migrate-user-activation-to-boolean-flags branch from 697c44d to f9614cc Compare June 21, 2026 09:05
@kate-k-lee
kate-k-lee force-pushed the eng/Migrate-user-activation-to-boolean-flags branch from f9614cc to 46c0ae9 Compare June 21, 2026 14:54
@kate-k-lee kate-k-lee added safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks merge-queue Applied to send a pull request to merge-queue and removed safe-merge-queue Applied to automatically send a pull-request to merge-queue after passing EWS checks labels Jun 21, 2026
@kate-k-lee
kate-k-lee force-pushed the eng/Migrate-user-activation-to-boolean-flags branch from 46c0ae9 to d2874f9 Compare June 21, 2026 17:04
@kate-k-lee

Copy link
Copy Markdown
Contributor Author

The failing win-tests (9) and ios-wk2 (~60) results are pre-existing, unrelated to this change. The identical failures appear across many unrelated PRs on the same queues (e.g. win-tests builds #92998–#93005 all show the same 9 failures; ios-wk2 builds #34853#34878 share ~57/60). This patch only migrates sticky/history-action user activation to boolean flags on LocalDOMWindow and touches none of these areas. Switching to unsafe-merge-queue.

@kate-k-lee kate-k-lee added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merge-queue Applied to send a pull request to merge-queue labels Jun 22, 2026
… flags

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

Reviewed by Youenn Fablet.

Per the user-activation data model change in the proposed
whatwg/html#11454, track sticky activation and history-action activation
as explicit booleans on LocalDOMWindow instead of deriving them from the
last activation timestamp. m_lastActivationTimestamp continues to drive
transient activation only.

notifyActivated and its ancestor/descendant propagation, consume-history-
action, and WebPage::updateUserActivationTimestamps now update the
booleans alongside the timestamp. This is not gated behind a preference.
Behavior is preserved, except that consuming transient activation no
longer resurrects an already-consumed history-action activation, which
matches the proposed explicit boolean model.

* Source/WebCore/page/LocalDOMWindow.cpp:
(WebCore::LocalDOMWindow::hasStickyActivation const):
(WebCore::LocalDOMWindow::hasHistoryActionActivation const):
(WebCore::LocalDOMWindow::consumeHistoryActionUserActivation):
(WebCore::LocalDOMWindow::notifyActivated):
* Source/WebCore/page/LocalDOMWindow.h:
(WebCore::LocalDOMWindow::setHasStickyActivation):
(WebCore::LocalDOMWindow::setHasHistoryActionActivation):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::didNotifyUserActivation):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::updateUserActivationState):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:

Canonical link: https://commits.webkit.org/315598@main
@webkit-commit-queue
webkit-commit-queue force-pushed the eng/Migrate-user-activation-to-boolean-flags branch from d2874f9 to a96f40e Compare June 22, 2026 14:10
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 315598@main (a96f40e): https://commits.webkit.org/315598@main

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

@webkit-commit-queue
webkit-commit-queue merged commit a96f40e into WebKit:main Jun 22, 2026
@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 Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DOM For bugs specific to XML/HTML DOM elements (including parsing).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants