Parse WebVTT REGION blocks into Layout objects#380
Merged
Conversation
Implement region parsing in the WebVTT reader so that cues referencing a region get proper origin/extent geometry (using W3C TTML-WebVTT mapping formulas), enabling correct cross-format conversion to DFXP and other positioned formats. Also includes: - Fix .x/.y typo in geometry.py fit_to_screen() safety guard - Fix _remove_noon_off_on_italics typo in SCC specialized_collections - Add empty-collection guard in _remove_spaces_at_end_of_the_line - Replace magic numbers with _InstructionNode constants - Remove dead _remove_styles() method from WebVTT reader - Remove redundant if-guard and unused class attributes in WebVTT writer
🟡 PR Compliance ReviewRisk Level: MEDIUM
REVIEW REQUIRED - Address issues before merging Full report available in workflow artifacts |
🟡 PR Compliance ReviewRisk Level: MEDIUM
REVIEW REQUIRED - Address issues before merging Full report available in workflow artifacts |
lorandvarga
previously approved these changes
Jul 2, 2026
🟡 PR Compliance ReviewRisk Level: MEDIUM
REVIEW REQUIRED - Address issues before merging Full report available in workflow artifacts |
lorandvarga
approved these changes
Jul 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implement region parsing in the WebVTT reader so that cues referencing
a region get proper origin/extent geometry (using W3C TTML-WebVTT
mapping formulas), enabling correct cross-format conversion to DFXP
and other positioned formats.
Also includes:
What changes for production
WebVTT files with REGION blocks: Previously region references were stored as raw passthrough only (no geometry). Now they produce Layout objects with computed origin/extent.
This is additive — cues without regions are unaffected.
VTT→VTT round-trip**: Preserved via
webvtt_positioningpassthrough (writer still outputs the raw cue settings string).SCC→all formats: No behavior change. The SCC fixes are pure renames/guards with identical runtime behavior.
geometry.py fix: Affects a safety guard for absolute-unit clamping. Currently unexploitable (all callers pass percent values), but now correctly checks both axes.