Closed paul-bivol closed 4 years ago
Thank you for raising this issue @paul-bivol . I do not believe that white space handling has any impact on whether content is active or not.
Tracing through the definitions from tts:showBackground
:
if the value of this attribute is
whenActive
, then the region's background is rendered only when content is selected into the region, where that content is also temporally active;
and
[temporally active]
A syntactic or semantic feature, e.g., an element or the presentation of an element, is temporally active when the current time of the selected time base intersects with the active time interval of the feature.
So your question resolves down to whether content is selected into a region if that content is only whitespace. I think the answer is yes, because no exception is made to suggest that whitespace is not content.
Now there is an additional question: could the use of XML white space handling remove all content from a span? The TTML2 default white space handling rules are defined, and used in synchronic flow processing. By my reading, a span containing only a linefeed gets treated as a single space character. It is therefore not altogether empty. This is what I see in implementations too.
Translating that back to your example, there is no ambiguity for reg2 because the two p
elements in reg2
are both active while their first whitespace-only span
child is active. Those spans each contain a single space character.
One more point: you phrase your initial question as:
is whitespace trimming and collapse performed before or after deciding if a region background is rendered or not?
The TTML2 specification of white space handling states the set of white space handling attributes that should be considered to apply to the intermediate XSL-FO document generated by the synchronic flow processing algorithm. That synchronic flow processing algorithm itself is a subsequent step to temporal slicing, so the computation of whether a region is temporally active or not must happen before the generation of that XSL-FO document, and therefore the scenario you describe is again not ambiguous: reg2's background is rendered when content selected into it is active, even if that content may be modified by the application of XML white space handling attributes.
Standard caveat as per §11.3.1:
Any implementation is permitted provided that the externally observable results are consistent with the results produced by this model.
Thank you very much @nigelmegitt for a very thorough and quick response.
Given a region having tts:showBackground="whenActive" and the content selected into it has xml:space="default", contains only whitespaces and is temporally active, is the region background visible in this case? In other words, is whitespace trimming and collapse performed before or after deciding if a region background is rendered or not?
Here is an example:
There is no ambiguity for reg1 as the whitespaces become temporally inactive when the rest of the text does. There is no ambiguity for reg3 as whitespaces are preserved and should be rendered. For reg2 there will be two whitespace only anonymous spans and a third whitespace only span surrounding a non-whitespace span that will become temporally inactive. If whitespace trimming happens before deciding if the region background is to be rendered then the background should dissapear. Otherwise it should continue to be rendered.