Changeset 260483 in webkit


Ignore:
Timestamp:
Apr 21, 2020 6:34:57 PM (4 years ago)
Author:
Alexey Shvayka
Message:

The visibilitychange event should bubble
https://bugs.webkit.org/show_bug.cgi?id=210829

Reviewed by Darin Adler.

Source/WebCore:

This change makes visibilitychange event bubble as per spec [1], aligning WebKit
with Blink and Gecko. Also fixes broken spec link to visibilityState attribute.

[1] https://w3c.github.io/page-visibility/#dfn-now-visible-algorithm (step 2)

Test: fast/events/page-visibility-transition-test.html

  • dom/Document.cpp:

(WebCore::Document::visibilityStateChanged):
(WebCore::Document::visibilityState const):

LayoutTests:

  • fast/events/page-visibility-transition-test-expected.txt:
  • fast/events/page-visibility-transition-test.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r260482 r260483  
     12020-04-21  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        The visibilitychange event should bubble
     4        https://bugs.webkit.org/show_bug.cgi?id=210829
     5
     6        Reviewed by Darin Adler.
     7
     8        * fast/events/page-visibility-transition-test-expected.txt:
     9        * fast/events/page-visibility-transition-test.html:
     10
    1112020-04-21  Simon Fraser  <simon.fraser@apple.com>
    212
  • trunk/LayoutTests/fast/events/page-visibility-transition-test-expected.txt

    r218747 r260483  
    77PASS document.hidden is false
    88PASS internals.scriptedAnimationsAreSuspended is false
     9PASS event.bubbles is true
    910PASS document.visibilityState is "hidden"
    1011PASS document.hidden is true
     
    1314PASS document.hidden is true
    1415PASS internals.scriptedAnimationsAreSuspended is true
     16PASS event.bubbles is true
    1517PASS document.visibilityState is "visible"
    1618PASS document.hidden is false
  • trunk/LayoutTests/fast/events/page-visibility-transition-test.html

    r218747 r260483  
    6565
    6666function onVisibilityChange() {
     67    shouldBeTrue("event.bubbles");
    6768    if (numVisibilityChanges == 1) {
    6869        checkIsPageHidden();
  • trunk/Source/WebCore/ChangeLog

    r260482 r260483  
     12020-04-21  Alexey Shvayka  <shvaikalesh@gmail.com>
     2
     3        The visibilitychange event should bubble
     4        https://bugs.webkit.org/show_bug.cgi?id=210829
     5
     6        Reviewed by Darin Adler.
     7
     8        This change makes `visibilitychange` event bubble as per spec [1], aligning WebKit
     9        with Blink and Gecko. Also fixes broken spec link to `visibilityState` attribute.
     10
     11        [1] https://w3c.github.io/page-visibility/#dfn-now-visible-algorithm (step 2)
     12
     13        Test: fast/events/page-visibility-transition-test.html
     14
     15        * dom/Document.cpp:
     16        (WebCore::Document::visibilityStateChanged):
     17        (WebCore::Document::visibilityState const):
     18
    1192020-04-21  Simon Fraser  <simon.fraser@apple.com>
    220
  • trunk/Source/WebCore/dom/Document.cpp

    r260435 r260483  
    17401740void Document::visibilityStateChanged()
    17411741{
    1742     // // https://w3c.github.io/page-visibility/#reacting-to-visibilitychange-changes
    1743     queueTaskToDispatchEvent(TaskSource::UserInteraction, Event::create(eventNames().visibilitychangeEvent, Event::CanBubble::No, Event::IsCancelable::No));
     1742    // https://w3c.github.io/page-visibility/#reacting-to-visibilitychange-changes
     1743    queueTaskToDispatchEvent(TaskSource::UserInteraction, Event::create(eventNames().visibilitychangeEvent, Event::CanBubble::Yes, Event::IsCancelable::No));
    17441744    for (auto* client : m_visibilityStateCallbackClients)
    17451745        client->visibilityStateChanged();
     
    17631763    // page. If there is no page associated with the document, we will assume
    17641764    // that the page is hidden, as specified by the spec:
    1765     // http://dvcs.w3.org/hg/webperf/raw-file/tip/specs/PageVisibility/Overview.html#dom-document-hidden
     1765    // https://w3c.github.io/page-visibility/#visibilitystate-attribute
    17661766    if (!m_frame || !m_frame->page())
    17671767        return VisibilityState::Hidden;
Note: See TracChangeset for help on using the changeset viewer.