Bug 1536762 - part5 : adjustment should only happen when box doesn't go over the boundary along the moving direction. r=heycam
authoralwu <alwu@mozilla.com>
Thu, 09 May 2019 18:46:12 +0000
changeset 532133 f40e952d155263f245887217b1cdbaa36a732688
parent 532132 f009e75ac8711195313ec4abc50602a756335a1c
child 532134 4e8c439818a32288a0f3466c73e15cdab54b05cb
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1536762
milestone68.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1536762 - part5 : adjustment should only happen when box doesn't go over the boundary along the moving direction. r=heycam When adjusting box's position, we would choose a axis first and move the box along this axis to see whether we can place this box without overlapping with other boxes and fully inside the rendering area. If the box has been over the boundary along the moving direction, we should move box back to the original position and change the moving direction to see whether we can find another best place for the box. Although the adjustment can run without timeout now, it still doesn't match the result of the reference, so change the state to `fail`. Differential Revision: https://phabricator.services.mozilla.com/D29765
dom/media/webvtt/vtt.jsm
testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/evil/9_cues_overlapping_completely.html.ini
testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/evil/9_cues_overlapping_completely_all_cues_have_same_timestamp.html.ini
--- a/dom/media/webvtt/vtt.jsm
+++ b/dom/media/webvtt/vtt.jsm
@@ -850,30 +850,29 @@ XPCOMUtils.defineLazyPreferenceGetter(th
     // Check if this box is within another box.
     within(container) {
       return this.top >= container.top &&
              this.bottom <= container.bottom &&
              this.left >= container.left &&
              this.right <= container.right;
     }
 
-    // Check if this box is entirely within the container or it is overlapping
-    // on the edge opposite of the axis direction passed. For example, if "+x" is
-    // passed and the box is overlapping on the left edge of the container, then
-    // return true.
-    overlapsOppositeAxis(container, axis) {
+    // Check whether this box is passed over the specfic axis boundary. The axis
+    // is based on the canvas coordinates, the `+x` is rightward and `+y` is
+    // downward.
+    isOutsideTheAxisBoundary(container, axis) {
       switch (axis) {
       case "+x":
-        return this.left < container.left;
+        return this.right > container.right;
       case "-x":
-        return this.right > container.right;
+        return this.left < container.left;
       case "+y":
-        return this.top < container.top;
+        return this.bottom > container.bottom;
       case "-y":
-        return this.bottom > container.bottom;
+        return this.top < container.top;
       }
     }
 
     // Find the percentage of the area that this box is overlapping with another
     // box.
     intersectPercentage(b2) {
       let x = Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)),
           y = Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)),
@@ -1000,17 +999,17 @@ XPCOMUtils.defineLazyPreferenceGetter(th
       // spec 7.2.10.3
       let bestPosition = {},
           specifiedPosition = box.clone(),
           outsideAreaPercentage = 1; // Highest possible so the first thing we get is better.
       let hasFoundBestPosition = false;
       const axis = ["-y", "-x", "+x", "+y"];
       const toMove = styleBox.getFirstLineBoxSize();
       for (let i = 0; i < axis.length && !hasFoundBestPosition; i++) {
-        while (box.overlapsOppositeAxis(containerBox, axis[i]) ||
+        while (!box.isOutsideTheAxisBoundary(containerBox, axis[i]) &&
                (!box.within(containerBox) || box.overlapsAny(outputBoxes))) {
           box.move(axis[i], toMove);
         }
         // We found a spot where we aren't overlapping anything. This is our
         // best position.
         if (box.within(containerBox)) {
           bestPosition = box.clone();
           hasFoundBestPosition = true;
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/evil/9_cues_overlapping_completely.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/evil/9_cues_overlapping_completely.html.ini
@@ -1,6 +1,2 @@
 [9_cues_overlapping_completely.html]
-  disabled:
-    if debug and (os == "linux"): bug1488673
-  expected:
-    if os == "android" and not e10s: ERROR
-    TIMEOUT
+  expected: FAIL
--- a/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/evil/9_cues_overlapping_completely_all_cues_have_same_timestamp.html.ini
+++ b/testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/evil/9_cues_overlapping_completely_all_cues_have_same_timestamp.html.ini
@@ -1,6 +1,2 @@
 [9_cues_overlapping_completely_all_cues_have_same_timestamp.html]
-  disabled:
-    if debug and (os == "linux"): bug1488673
-  expected:
-    if os == "android" and not e10s: ERROR
-    TIMEOUT
+  expected: FAIL