Граф коммитов

148 Коммитов

Автор SHA1 Сообщение Дата
Alastor Wu 2e47becfef Bug 1571908 - part6 : add debug logs. r=heycam
Add debug logs to show which mode we're using to adjust cue's position.

Differential Revision: https://phabricator.services.mozilla.com/D42434

--HG--
extra : moz-landing-system : lando
2019-08-21 07:10:27 +00:00
Alastor Wu b43ac32ce9 Bug 1571908 - part4 : remove redudant function. r=heycam
We have already had a exactly same function, so can remove a redundant one.

Differential Revision: https://phabricator.services.mozilla.com/D41132

--HG--
extra : moz-landing-system : lando
2019-08-21 07:10:26 +00:00
Alastor Wu 139cf6cc13 Bug 1571908 - part3 : optimize the result of adjusting position for cues with 'snapToLines=false'. r=heycam
When adjusting cues with `snapToLines=false`, first we would generate an array with all different axises which we would use to move cue on the specific direction.

However, for the different writing directions, we should have different priority for the moving directions.
For example, if the wriring direction is `horizontal`, which means cues will grow from the top to the bottom, then moving cues along the `y` axis should be more important than moving cues along the `x` axis, and vice versa for those cues growing from the left to right, or from the right to the left.

After decided the moving direction, then we have to decide the moving offset. Now we use line box's Bsize as a basic moving unit.

Moving cues, however, by such as large distance as a time would cause too many redudant space between cue boxes, which doesn't provide a good enough visual arrangement result. Therefore, we divide the Bsize by a factor, which can control the granularity of the moving unit and can still preverse a reasonable space between boxes. That can provide way better visual result than the one we had used before, and still has certain good performance comparing with moving 1px at a time.

Differential Revision: https://phabricator.services.mozilla.com/D41131

--HG--
extra : moz-landing-system : lando
2019-08-21 07:10:26 +00:00
Alastor Wu f5fee479ba Bug 1571908 - part2 : return null if we can't place the cue box inside the video rendering area. r=heycam
When adjusting the position of the cue box, if we can't find a proper place to display the cue within the video rendering area, we should return `null` and not to show it on the screen.

Differential Revision: https://phabricator.services.mozilla.com/D40901

--HG--
extra : moz-landing-system : lando
2019-08-21 07:10:25 +00:00
Alastor Wu 80cb50a3a9 Bug 1571908 - part1 : use correct width and height to compute position percentage. r=heycam
When calculating position percentage, `top` should divide the height of the video rendering area, and `left` should divide the width of the video rendering area.

Differential Revision: https://phabricator.services.mozilla.com/D40900

--HG--
extra : moz-landing-system : lando
2019-08-21 07:10:31 +00:00
alwu ae4242d665 Bug 1305732 - part7 : remove duplicated declaration. r=heycam
We have declared `supportPseudo`, remove the duplicated declaration.

Differential Revision: https://phabricator.services.mozilla.com/D36851

--HG--
extra : moz-landing-system : lando
2019-07-08 04:47:46 +00:00
alwu c2ca57258b Bug 1305732 - part5 : set CSS properties directly on '::cue'. r=heycam,emilio
According to the spec [1], we have to set those CSS properties on the root node, and then this root node would have a child node, background box [2], which would contain all other child nodes.

In our case, the background box is `cueDiv` [3].

In theory, all those properties set on the root node should be inherited by the background box. However, when the background box is a pseudo element `::cue`, they won't be directly inherit from the the background box's parent, inherited styles would acutally come from video instead.

Therefore, we have to directly set these properties on the pseudo element and mark them as `!important` to avoid being overrided by user style script.

[1] https://www.w3.org/TR/webvtt1/#ref-for-list-of-webvtt-node-objects-9
[2] https://www.w3.org/TR/webvtt1/#webvtt-cue-background-box
[3] https://searchfox.org/mozilla-central/rev/11712bd3ce7454923e5931fa92eaf9c01ef35a0a/dom/media/webvtt/vtt.jsm#533-534

Differential Revision: https://phabricator.services.mozilla.com/D35694

--HG--
extra : moz-landing-system : lando
2019-07-09 01:42:45 +00:00
alwu fdde30fdd6 Bug 1305732 - part4 : background box should be a inline node. r=heycam
According to the spec [1], the background box should be `display:inline`.

Therefore, we should create a `<span>`, which already is an inline element, for the background box, not a `<div>`, which is a block element.

In addition, when the pseudo element is enabled, even though the element is currently a `div`, it doesn't match the div `{ display: block; }` rule from the UA style sheet because the pseudo element only matches `::cue` rules. It also has the initial value of display which is `inline`.

[1] https://www.w3.org/TR/webvtt1/#webvtt-cue-background-box

Differential Revision: https://phabricator.services.mozilla.com/D36849

--HG--
extra : moz-landing-system : lando
2019-07-08 18:02:53 +00:00
alwu 044a87f6e8 Bug 1305732 - part3 : remove redundent properties setting on non-pseudo background node. r=heycam
If the background node is not a pseudo element, these properties would actually be inherited, so we have no need to set them again.

Differential Revision: https://phabricator.services.mozilla.com/D36848

--HG--
extra : moz-landing-system : lando
2019-07-08 04:45:01 +00:00
alwu 85d9f025b6 Bug 1305732 - part2 : list all properties set on the root node in one place to make them clear. r=heycam
In order to clearly see what properties are applied on the root node, create a function to list all of them together.

Differential Revision: https://phabricator.services.mozilla.com/D36847

--HG--
extra : moz-landing-system : lando
2019-07-08 04:44:47 +00:00
Alastor Wu 540674f2db Bug 1305732 - part1 : don't show the box with zero width or height. r=heycam
Setting cue's position would also affect cue box's size which would be determined by cue's position alignment as well. If the cue box's width or height is zero, it means that this box should not be display on the screen and we should clear cue's display state as well.

Differential Revision: https://phabricator.services.mozilla.com/D35693

--HG--
extra : moz-landing-system : lando
2019-07-03 23:07:43 +00:00
Alastor Wu fd5355860a Bug 1562021 - part3 : cancel old VTT listener when we start a new load. r=jya,baku
When we start a new load, all previous data fetching from the previous listener and all state changing applied to track element should be ignored.

Therefore, we add a new method `Cancel()` which owner of the listener should call when we would like to discard current listener.

Differential Revision: https://phabricator.services.mozilla.com/D36407

--HG--
extra : moz-landing-system : lando
2019-07-03 23:23:29 +00:00
alwu c7b361e5b5 Bug 1556079 - part1 : hide cue if we can't find a good place to put it fully inside the rendering area. r=heycam
According to the spec 7.2.10.17 [1], if we have tried both direction and there is no place to put the cue inside the rendering area without overlapping with other cues or the boundary of rendering area, then we have to discard all CSS boxes, which means that we should not display this cue.

[1] https://www.w3.org/TR/webvtt1/#processing-cue-settings

Differential Revision: https://phabricator.services.mozilla.com/D33729

--HG--
extra : moz-landing-system : lando
2019-06-14 00:26:54 +00:00
alwu ecdd9d203f Bug 1557182 - part4 : add fuzzy for the boundary comparision. r=heycam
When the check whether boxes are overlapping or box is placing out side the container boundary, we should use fuzzy for this checking if the difference is small enough to be ignored.

When two boxes just overlapped a little bit (like < 0.01 px), which user can't be aware of it and looks like just placing side by side, we acutally don't need to adjust box position again.

Otherwise, it would result in an obvious space between two boxes which makes it look more weird because the basic moving unit for adjusting boxes is the Bsize of the first line box.

In addition, adding fuzzy can also ensure rendering testing can be more robust, because on some platform the cues would overlap a really tiny amount of pixels and causes box moving up more than our expectation, which result in incorrect rendering comparasion.

Differential Revision: https://phabricator.services.mozilla.com/D34577

--HG--
extra : moz-landing-system : lando
2019-06-14 01:47:45 +00:00
alwu 493294ac94 Bug 1555849 - part1 : use 'computeLine' to adjust cue's position when 'snap-to-lines' is false. r=heycam
According to the spec 7.2.6 [1], we should use `computed line`, not `computed position`.

[1] https://www.w3.org/TR/webvtt1/#ref-for-cue-computed-line-2

Differential Revision: https://phabricator.services.mozilla.com/D33236

--HG--
extra : moz-landing-system : lando
2019-06-13 23:08:54 +00:00
Narcis Beleuzu 4d0ca3dce9 Backed out changeset a7c18cfb94b3 (bug 1556079) for assertion failures at parserWrapper. CLOSED TREE
--HG--
extra : rebase_source : b3e0b049a6d18081242eb40ff7fce8e80d04c700
2019-06-14 00:59:22 +03:00
alwu 986c5f9738 Bug 1556079 - part1 : hide cue if we can't find a good place to put it fully inside the rendering area. r=heycam
According to the spec 7.2.10.17 [1], if we have tried both direction and there is no place to put the cue inside the rendering area without overlapping with other cues or the boundary of rendering area, then we have to discard all CSS boxes, which means that we should not display this cue.

[1] https://www.w3.org/TR/webvtt1/#processing-cue-settings

Differential Revision: https://phabricator.services.mozilla.com/D33729

--HG--
extra : moz-landing-system : lando
2019-06-13 20:10:53 +00:00
Alastor Wu 0b9fc3bd0f Bug 1557882 - part1 : delay setting 'unicode-bidi' until finishing the position calculation. r=heycam
Because of bug1558431, now the text alignment for `bidi` won't take effect on the initial reflow of the document, so we have to delay setting 'unicode-bidi' in order to trigger reflow again as a workaround.

It would make the `bidi` text showing correctly after reflow.

Differential Revision: https://phabricator.services.mozilla.com/D34640

--HG--
extra : moz-landing-system : lando
2019-06-13 18:59:35 +00:00
alwu 7ff878afe4 Bug 1555836 - use the pref to dynamically switch vtt debug log. r=heycam
It would be more convenient to use the pref to dynamically switch vtt debug log on/off without changing any code.

Differential Revision: https://phabricator.services.mozilla.com/D33220

--HG--
extra : moz-landing-system : lando
2019-06-13 18:43:08 +00:00
alwu 4b5ebae438 Bug 1555197 - part3 : modify log. r=jya
Add and modify some log content in order to help debugging.

Differential Revision: https://phabricator.services.mozilla.com/D32936

--HG--
extra : moz-landing-system : lando
2019-05-30 07:39:40 +00:00
alwu de12be8c5d Bug 1555197 - part2 : handle state `REUSE AND CLEAR`. r=heycam
According to the spec [1] step 13, if we won't reset cues' display state, we should reuse them.

If the amount of displaying cues changes, which means some cues should disappear from the screen and some of them should still be showed, we have to clear the screen and resume displaying cues' display state.

As the amount of displaying cues might affect the computed result of cues' display state, if we recompute cues' display state in this situaion, the result would be different from the one we had last time.

For example, there are two cues, Cue0 [0:2], Cue1 [1:5]. When Cue0 disappears, Cue1 should stay in the same position.

```
  [playing at 1s]
*-------------------*
|        Cue1       |
|        Cue0       |
*-------------------*

  [playing at 3s] (correct)
*-------------------*
|        Cue1       |
|                   |
*-------------------*

  [playing at 3s] (incorrect)
*-------------------*
|                   |
|        Cue1       |
*-------------------*
```

[1] https://w3c.github.io/webvtt/#rules-for-updating-the-display-of-webvtt-text-tracks

Differential Revision: https://phabricator.services.mozilla.com/D32935

--HG--
extra : moz-landing-system : lando
2019-06-13 18:03:32 +00:00
alwu 5e558f7e28 Bug 1555197 - part1 : introduce new state to distinguish different situations for showing cues' display state. r=heycam
Cue's display state is a DIV element with corresponding CSS style to display cue on the screen. When the cue is being displayed first time, we will compute its display state.

After that, we could reuse its state until following conditions happen.
(1) control changes : it means the rendering area changes so we should recompute cues' position.
(2) cue's `hasBeenReset` flag is true : it means cues' line or position property has been modified, we also need to recompute cues' position.
(3) the amount of showing cues changes : it means some cue would disappear but other cues should stay at the same place without recomputing, so we can resume their display state.

The new state includes `REUSE`, `REUSE AND CLEAR` and `COMPUTE AND CLEAR`, our current behavior doesn't handle `REUSE AND CLEAR, which would be implemented in next patch.

Differential Revision: https://phabricator.services.mozilla.com/D32934

--HG--
extra : moz-landing-system : lando
2019-06-13 17:56:43 +00:00
alwu 42a422a332 Bug 1555825 - part1 : append a text node with empty value when input is an empty string. r=heycam
According to the spec [1], text node has a value to represent its text, even when its text is an empty string.

Therefore, we should append a text node with a value for empty text string on the DocumentFragment we return, when input sting is an empty string.

[1] https://w3c.github.io/webvtt/#webvtt-text-object

Differential Revision: https://phabricator.services.mozilla.com/D33215

--HG--
extra : moz-landing-system : lando
2019-06-13 15:42:11 +00:00
Alastor Wu 0195200d42 Bug 1551385 - part2 : recompute display state when display cues amount is different from the one we rendered last time. r=heycam
If the amount of cues which are going to be displayed is different from the one we displayed last time, we have to compute cues' display state again because cue's position might be affected by other cues.

Differential Revision: https://phabricator.services.mozilla.com/D31170

--HG--
extra : moz-landing-system : lando
2019-05-23 21:25:13 +00:00
Alastor Wu 102628f8e2 Bug 1551385 - part1 : let 'processCue()' handle cleaning cues div. r=heycam
We can actually let `processCue()` to handle rendering cues or cleaning displayed cues, no need to use another way to clear the cue.

The advantages is to make the code cleaner and easier to read, now we just need to know JS side would handle all rendering stuffs for us. We don't need to have different behavior when there is no showing cue.

The way we clear displayed cues are intuitive, we would remove all child nodes under the overlay, which are used to display cues.

Differential Revision: https://phabricator.services.mozilla.com/D31171

--HG--
extra : moz-landing-system : lando
2019-05-23 21:25:14 +00:00
Andreea Pavel 21ad779f6a Backed out 3 changesets (bug 1551385) for breaking reftests at vtt_overlapping_time.html on a CLOSED TREE
Backed out changeset 4268e661e741 (bug 1551385)
Backed out changeset fb20dcf3c072 (bug 1551385)
Backed out changeset 883151b42d88 (bug 1551385)
2019-05-24 00:23:19 +03:00
Alastor Wu e28b6b0b52 Bug 1551385 - part2 : recompute display state when display cues amount is different from the one we rendered last time. r=heycam
If the amount of cues which are going to be displayed is different from the one we displayed last time, we have to compute cues' display state again because cue's position might be affected by other cues.

Differential Revision: https://phabricator.services.mozilla.com/D31170

--HG--
extra : moz-landing-system : lando
2019-05-23 18:13:13 +00:00
Alastor Wu ceefe2a70a Bug 1551385 - part1 : let 'processCue()' handle cleaning cues div. r=heycam
We can actually let `processCue()` to handle rendering cues or cleaning displayed cues, no need to use another way to clear the cue.

The advantages is to make the code cleaner and easier to read, now we just need to know JS side would handle all rendering stuffs for us. We don't need to have different behavior when there is no showing cue.

The way we clear displayed cues are intuitive, we would remove all child nodes under the overlay, which are used to display cues.

Differential Revision: https://phabricator.services.mozilla.com/D31171

--HG--
extra : moz-landing-system : lando
2019-05-22 05:39:40 +00:00
Alastor Wu ffa1d889f4 Bug 1551045 - add debug log in `vtt.jsm`. r=heycam
We should add some debug logs, which should be easily enable and disable, in vtt.jsm in order to increase the efficiency of debugging.

Differential Revision: https://phabricator.services.mozilla.com/D30798

--HG--
extra : moz-landing-system : lando
2019-05-12 22:56:06 +00:00
alwu 6b41d4e549 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

--HG--
extra : moz-landing-system : lando
2019-05-09 18:46:12 +00:00
alwu 119f85db3a Bug 1536762 - part2 : use first line box's size as positioning basic unit. r=heycam,baku
According to the spec [1] 7.2.10.2, we should use the first line box's height or width as positioning unit to adjust box's position.

We will also use this value to adjust box when `snap-to-line` is false.

There, we implement a new chrome-only API to acquire this information, which would return the first line box's size in the `block` frame.

[1] https://www.w3.org/TR/webvtt1/#ref-for-webvtt-cue-snap-to-lines-flag-12

Differential Revision: https://phabricator.services.mozilla.com/D29745

--HG--
extra : moz-landing-system : lando
2019-05-09 19:22:33 +00:00
alwu 9ea9ba3929 Bug 1536762 - part1 : use unscaled bounding box'size as a cue box's size. r=baku,heycam
When adjusting cue's position, the goal is to place cue boxes fully inside the rendering area, and place in the right place.

In order to check whether the box is correctly inside the rendering area, we have to know the correct size of the cue box.

Therefore, we implement the new chrome-only APIs to acquire this information (box's height and width), and this returned value won't be affected by CSS transformation, which is good for positioning.

Differential Revision: https://phabricator.services.mozilla.com/D27178

--HG--
extra : moz-landing-system : lando
2019-05-09 18:26:17 +00:00
Alastor Wu 5017bb4783 Bug 1488673 - part8 : remove unnecessary anonymous function. r=heycam
There is no need to have an anonymous function after we replace all `var` to `let`, now those variables won't pollute outer scopes.

Differential Revision: https://phabricator.services.mozilla.com/D20028

--HG--
extra : moz-landing-system : lando
2019-03-19 03:31:43 +00:00
Alastor Wu fd28fe7a4e Bug 1488673 - part7 : huge replacement of 'var' by 'let'. r=heycam
In order to keep the local variable only visible inside the function scope, we should only use 'let' for those variables.

Differential Revision: https://phabricator.services.mozilla.com/D20027

--HG--
extra : moz-landing-system : lando
2019-03-19 03:31:20 +00:00
Alastor Wu 508719c298 Bug 1488673 - part6 : remove unused functions. r=heycam
Remove those funcitons which are used to implement the previous way to move the cue box.

Differential Revision: https://phabricator.services.mozilla.com/D19610

--HG--
extra : moz-landing-system : lando
2019-03-19 03:30:32 +00:00
Alastor Wu 3addeaf47c Bug 1488673 - part5 : find the best position for the cue box in order not to overlap it with other cue boxes. r=heycam
According to the spec 7.2.10 [1], the step13 to step21 (snap-to-line is true) and the step3 to step5 (snap-to-line is false), we need to find the best position where the cue box has least overlap with other cue boxes.

In addition, in order not to be affected by CSS transformation, use non-tranformed attribute in `BoxPosition`.

[1]
https://w3c.github.io/webvtt/#ref-for-webvtt-cue-snap-to-lines-flag-12
https://w3c.github.io/webvtt/#ref-for-webvtt-cue-snap-to-lines-flag-13

Differential Revision: https://phabricator.services.mozilla.com/D22578

--HG--
extra : moz-landing-system : lando
2019-03-19 03:30:09 +00:00
Alastor Wu ae09d890c0 Bug 1488673 - part4 : adjust cue's position. r=heycam
According to the spec 7.2.10, step1 to step10 (snap-to-line is true) and step1 to step2 (snap-to-line is flase) [1], we would adjust cue box's position depending on the algorithm.

The algorithm would calculate the cue box's top (or left) position depending on the writing direction, and move the box to the specific position.

However, if the cue box is overlapping with other cue boxes in the rendering area, we would still need to adjust its postion, which will be implemented in next patch.

[1]
https://w3c.github.io/webvtt/#ref-for-webvtt-cue-snap-to-lines-flag-12
https://w3c.github.io/webvtt/#ref-for-webvtt-cue-snap-to-lines-flag-13

Differential Revision: https://phabricator.services.mozilla.com/D19609

--HG--
extra : moz-landing-system : lando
2019-03-19 03:29:36 +00:00
Alastor Wu d710d5d54b Bug 1488673 - part3 : only use BoxPosition format for position calculation r=heycam
It's confused that we have both simpleBoxPosition object and BoxPosition object, we should only use one format to perform all box related operations.

Therefore, BoxPosition should be able to be initiaized by StyleBox, HTMLElement or BoxPosition.

In addition, as `right` and `bottom` can be calculated from other attributes, we remove these two attributes from BoxPosition, and use getter to get the correct value, which can reduce some unnessary modification when we changes the `height` or `width`. In order to implement a more readable getter, so we change `BoxPosition` to class-based.

Differential Revision: https://phabricator.services.mozilla.com/D22809

--HG--
extra : moz-landing-system : lando
2019-03-19 03:29:29 +00:00
Alastor Wu 44d26f1c7f Bug 1488673 - part2 : keep font size consistent even if applying CSS transform scale on the parent element r=heycam
When calculating font size, we should use the original bounding box as a reference, or it would cause incorrect font size scale.

Differential Revision: https://phabricator.services.mozilla.com/D20026

--HG--
extra : moz-landing-system : lando
2019-03-19 03:29:27 +00:00
Alastor Wu c36028fc0f Bug 1488673 - part1 : use correct size to calculate position. r=heycam
According to the spec [1], we have calculated the size in step 7.3 and then we should use that for calculating x-position and y-position, instead of using cue's size.

[1] https://w3c.github.io/webvtt/#apply-webvtt-cue-settings

Differential Revision: https://phabricator.services.mozilla.com/D22808

--HG--
extra : moz-landing-system : lando
2019-03-19 03:27:04 +00:00
shindli 3315ea9026 Backed out 10 changesets (bug 1488673) for permafailing wpt tests in /html/semantics/embedded-content/media-elements/track/track-element/track-cue-rendering-line-doesnt-fit.html CLOSED TREE
Backed out changeset 58bd4444d2c5 (bug 1488673)
Backed out changeset faa494b301b9 (bug 1488673)
Backed out changeset b7cea852fc6b (bug 1488673)
Backed out changeset f264bc709b32 (bug 1488673)
Backed out changeset 5b3ae7eb7842 (bug 1488673)
Backed out changeset 9fa072a4b67d (bug 1488673)
Backed out changeset d18858a1fe8b (bug 1488673)
Backed out changeset e5030bf46846 (bug 1488673)
Backed out changeset 9206cafa8778 (bug 1488673)
Backed out changeset ca1266e7fbad (bug 1488673)
2019-03-18 11:50:08 +02:00
Alastor Wu 950afd4d30 Bug 1488673 - part8 : remove unnecessary anonymous function. r=heycam
There is no need to have an anonymous function after we replace all `var` to `let`, now those variables won't pollute outer scopes.

Differential Revision: https://phabricator.services.mozilla.com/D20028

--HG--
extra : moz-landing-system : lando
2019-03-13 16:27:19 +00:00
Alastor Wu a84641d33a Bug 1488673 - part7 : huge replacement of 'var' by 'let'. r=heycam
In order to keep the local variable only visible inside the function scope, we should only use 'let' for those variables.

Differential Revision: https://phabricator.services.mozilla.com/D20027

--HG--
extra : moz-landing-system : lando
2019-03-14 09:38:37 +00:00
Alastor Wu 3efd4f2e8f Bug 1488673 - part6 : remove unused functions. r=heycam
Remove those funcitons which are used to implement the previous way to move the cue box.

Differential Revision: https://phabricator.services.mozilla.com/D19610

--HG--
extra : moz-landing-system : lando
2019-03-14 09:39:53 +00:00
Alastor Wu ea20eb6bb5 Bug 1488673 - part5 : find the best position for the cue box in order not to overlap it with other cue boxes. r=heycam
According to the spec 7.2.10 [1], the step13 to step21 (snap-to-line is true) and the step3 to step5 (snap-to-line is false), we need to find the best position where the cue box has least overlap with other cue boxes.

In addition, in order not to be affected by CSS transformation, use non-tranformed attribute in `BoxPosition`.

[1]
https://w3c.github.io/webvtt/#ref-for-webvtt-cue-snap-to-lines-flag-12
https://w3c.github.io/webvtt/#ref-for-webvtt-cue-snap-to-lines-flag-13

Differential Revision: https://phabricator.services.mozilla.com/D22578

--HG--
extra : moz-landing-system : lando
2019-03-14 07:22:33 +00:00
Alastor Wu 6c6cc4b4ad Bug 1488673 - part4 : adjust cue's position. r=heycam
According to the spec 7.2.10, step1 to step10 (snap-to-line is true) and step1 to step2 (snap-to-line is flase) [1], we would adjust cue box's position depending on the algorithm.

The algorithm would calculate the cue box's top (or left) position depending on the writing direction, and move the box to the specific position.

However, if the cue box is overlapping with other cue boxes in the rendering area, we would still need to adjust its postion, which will be implemented in next patch.

[1]
https://w3c.github.io/webvtt/#ref-for-webvtt-cue-snap-to-lines-flag-12
https://w3c.github.io/webvtt/#ref-for-webvtt-cue-snap-to-lines-flag-13

Differential Revision: https://phabricator.services.mozilla.com/D19609

--HG--
extra : moz-landing-system : lando
2019-03-13 16:27:17 +00:00
Alastor Wu bc66137e1a Bug 1488673 - part3 : only use BoxPosition format for position calculation r=heycam
It's confused that we have both simpleBoxPosition object and BoxPosition object, we should only use one format to perform all box related operations.

Therefore, BoxPosition should be able to be initiaized by StyleBox, HTMLElement or BoxPosition.

In addition, as `right` and `bottom` can be calculated from other attributes, we remove these two attributes from BoxPosition, and use getter to get the correct value, which can reduce some unnessary modification when we changes the `height` or `width`. In order to implement a more readable getter, so we change `BoxPosition` to class-based.

Differential Revision: https://phabricator.services.mozilla.com/D22809

--HG--
extra : moz-landing-system : lando
2019-03-14 09:29:31 +00:00
Alastor Wu 89ca31731a Bug 1488673 - part2 : keep font size consistent even if applying CSS transform scale on the parent element r=heycam
When calculating font size, we should use the original bounding box as a reference, or it would cause incorrect font size scale.

Differential Revision: https://phabricator.services.mozilla.com/D20026

--HG--
extra : moz-landing-system : lando
2019-03-13 16:27:18 +00:00
Alastor Wu a8b183849a Bug 1488673 - part1 : use correct size to calculate position. r=heycam
According to the spec [1], we have calculated the size in step 7.3 and then we should use that for calculating x-position and y-position, instead of using cue's size.

[1] https://w3c.github.io/webvtt/#apply-webvtt-cue-settings

Differential Revision: https://phabricator.services.mozilla.com/D22808

--HG--
extra : moz-landing-system : lando
2019-03-14 01:37:42 +00:00
Kris Maglione 39c294db57 Bug 1524688: Part 52 - Convert WebVTT components to static registration. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D18462

--HG--
rename : dom/media/webvtt/WebVTTParserWrapper.js => dom/media/webvtt/WebVTTParserWrapper.jsm
extra : rebase_source : 15b0b5dc533b7f9341498264cbf3ca36cff8e746
extra : source : 11f6682d9d9eedc6edcb2b8a496ae34501360c13
2019-01-30 11:31:25 -08:00