Changeset 259850 in webkit


Ignore:
Timestamp:
Apr 9, 2020 11:55:13 PM (4 years ago)
Author:
Peng Liu
Message:

REGRESSION: (r258434) [ Mac WK1 ] media/track/track-css-user-override.html is a flaky failure
https://bugs.webkit.org/show_bug.cgi?id=210134

Reviewed by Eric Carlson.

Source/WebCore:

Call captionPreferencesChanged() directly in CaptionUserPreferences::setCaptionsStyleSheetOverride().

  • page/CaptionUserPreferences.cpp:

(WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride):

LayoutTests:

Make the test reliable by replacing the timer and testExpected based approach
with the approach based on testExpectedEventually. Also remove unnecessary code.

  • media/track/track-css-user-override.html:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r259844 r259850  
     12020-04-09  Peng Liu  <peng.liu6@apple.com>
     2
     3        REGRESSION: (r258434) [ Mac WK1 ] media/track/track-css-user-override.html is a flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=210134
     5
     6        Reviewed by Eric Carlson.
     7
     8        Make the test reliable by replacing the timer and testExpected based approach
     9        with the approach based on testExpectedEventually. Also remove unnecessary code.
     10
     11        * media/track/track-css-user-override.html:
     12
    1132020-04-09  Cathie Chen  <cathiechen@igalia.com>
    214
  • trunk/LayoutTests/media/track/track-css-user-override.html

    r239181 r259850  
    1111            var seekCount = 0;
    1212
    13             function seeked()
     13            async function seeked()
    1414            {
    1515                var currentCue = textTrackDisplayElement(video, 'cue');
     
    2424                stylesheet = styleElement.sheet;
    2525                run("stylesheet.insertRule('video::cue { color: purple; background-color: lime; }', 0)");
    26                 document.body.offsetTop;
    2726                testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(128, 0, 128)");
    2827                testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(0, 255, 0)");
    2928
    3029                consoleWrite("<br>** Add an override, without '!important' **");
    31                 document.body.offsetTop;
    3230                run("internals.setCaptionsStyleSheetOverride('video::cue { color: blue; background-color: yellow; }')");
    3331                consoleWrite("internals.captionsStyleSheetOverride = " + internals.captionsStyleSheetOverride());
    34                 document.body.offsetTop;
    3532                testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(128, 0, 128)");
    3633                testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(0, 255, 0)");
     
    3835                consoleWrite("<br>** Mark background-color '!important' **");
    3936                run("internals.setCaptionsStyleSheetOverride('video::cue { color: blue ; background-color: yellow !important; }')");
    40                 // The style is not immediately updated, schedule the rest of the test with a zero timeout timer.
    41                 setTimeout(function() {
    42                     testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(128, 0, 128)");
    43                     testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(255, 255, 0)");
     37                testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(128, 0, 128)");
     38                // The style is not immediately updated.
     39                await testExpectedEventually("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(255, 255, 0)");
    4440
    45                     consoleWrite("<br>** Mark color '!important' **");
    46                     run("stylesheet.insertRule('video::cue { color: blue !important; background-color: yellow  !important; }', 0)");
    47                     document.body.offsetTop;
    48                     testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(0, 0, 255)");
    49                     testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(255, 255, 0)");
     41                consoleWrite("<br>** Mark color '!important' **");
     42                run("stylesheet.insertRule('video::cue { color: blue !important; background-color: yellow  !important; }', 0)");
     43                // The style is not immediately updated.
     44                await testExpectedEventually("getComputedStyle(textTrackDisplayElement(video, 'cue')).color", "rgb(0, 0, 255)");
     45                testExpected("getComputedStyle(textTrackDisplayElement(video, 'cue')).backgroundColor", "rgb(255, 255, 0)");
    5046
    51                     consoleWrite("");
    52                     endTest();
    53                 }, 100);
     47                consoleWrite("");
     48                endTest();
    5449            }
    5550
     
    6560            }
    6661
    67         setCaptionDisplayMode('Automatic');
     62            setCaptionDisplayMode('Automatic');
    6863        </script>
    6964    </head>
  • trunk/Source/WebCore/ChangeLog

    r259846 r259850  
     12020-04-09  Peng Liu  <peng.liu6@apple.com>
     2
     3        REGRESSION: (r258434) [ Mac WK1 ] media/track/track-css-user-override.html is a flaky failure
     4        https://bugs.webkit.org/show_bug.cgi?id=210134
     5
     6        Reviewed by Eric Carlson.
     7
     8        Call captionPreferencesChanged() directly in CaptionUserPreferences::setCaptionsStyleSheetOverride().
     9
     10        * page/CaptionUserPreferences.cpp:
     11        (WebCore::CaptionUserPreferences::setCaptionsStyleSheetOverride):
     12
    1132020-04-09  Cathie Chen  <cathiechen@igalia.com>
    214
  • trunk/Source/WebCore/page/CaptionUserPreferences.cpp

    r258693 r259850  
    399399    m_captionsStyleSheetOverride = override;
    400400    updateCaptionStyleSheetOverride();
    401     if (!m_timer.isActive())
    402         m_timer.startOneShot(0_s);
     401    captionPreferencesChanged();
    403402}
    404403
Note: See TracChangeset for help on using the changeset viewer.