Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Unified Diff: third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html

Issue 2803243002: Use a ResizeObserver to determine default font-size for text tracks (Closed)
Patch Set: Rebase Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html
diff --git a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html
index 13f7ce90b5a5f27b3f96f749451f4888d70b22e7..a0eec76eb14e3aa46f6d9baed4a1d588659b9dd0 100644
--- a/third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html
+++ b/third_party/WebKit/LayoutTests/media/track/track-cue-rendering.html
@@ -4,6 +4,7 @@
<script src="../media-controls.js"></script>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
+<script src="../../resources/run-after-layout-and-paint.js"></script>
<video>
<track src="captions-webvtt/captions.vtt" kind="captions" default>
</video>
@@ -26,29 +27,30 @@ async_test(function(t) {
if (++cueTextIndex == cueText.length) {
// Test the cue display colors and font.
- testFontSize(320, 240);
- testFontSize(640, 480);
- testFontSize(1280, 960);
- testFontSize(2560, 1440);
-
- assert_equals(getComputedStyle(textTrackContainerElement(video)).fontFamily, "sans-serif");
- assert_equals(getComputedStyle(textTrackContainerElement(video)).color, "rgb(255, 255, 255)");
- assert_equals(getComputedStyle(textTrackDisplayElement(video).firstChild).backgroundColor, "rgba(0, 0, 0, 0.8)");
-
- t.done();
+ testFontSize([[2560, 1440], [1280, 960], [640, 480], [320, 240]]);
} else {
video.currentTime += 1;
}
});
- function testFontSize(width, height) {
- video.width = width;
- video.height = height;
- // Force a relayout of the document
- document.body.offsetTop;
- assert_equals(getComputedStyle(textTrackContainerElement(video)).fontSize, parseInt(height * 0.05) + "px");
+ function testFontSize(subjects) {
+ var dimensions = subjects.shift();
+ video.width = dimensions[0];
+ video.height = dimensions[1];
+ runAfterLayoutAndPaint(t.step_func(function() {
+ assert_equals(getComputedStyle(textTrackContainerElement(video)).fontSize, parseInt(video.height * 0.05) + "px");
+ if (subjects.length) {
+ testFontSize(subjects);
+ } else {
+ assert_equals(getComputedStyle(textTrackContainerElement(video)).fontFamily, "sans-serif");
+ assert_equals(getComputedStyle(textTrackContainerElement(video)).color, "rgb(255, 255, 255)");
+ assert_equals(getComputedStyle(textTrackDisplayElement(video).firstChild).backgroundColor, "rgba(0, 0, 0, 0.8)");
+
+ t.done();
+ }
+ }));
}
video.currentTime = 0.5;
});
-</script>
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/HTMLMediaElement.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698