W3C home > Mailing lists > Public > public-html@w3.org > February 2014

Re: DataCue questions

From: Brendan Long <self@brendanlong.com>
Date: Fri, 14 Feb 2014 21:31:03 -0600
On Sat, 2014-02-15 at 13:40 +1100, Silvia Pfeiffer wrote:

> On Tue, Feb 11, 2014 at 8:51 AM, Brendan Long <self@brendanlong.com> wrote:
> > I think I was reading this too fast and missed this, which seems to apply
> > already:
> >
> > If text track list of cues' associated rules for updating the text track
> > rendering are not the same rules for updating the text track rendering as
> > appropriate for cue, then throw an InvalidStateError exception and abort
> > these steps.
> >
> > Sorry for the list-spam.
> 
> I'm a bit confused. Do you still have any open questions?


I'm still wondering about my original two questions:


> According to this, .text can be null:
> 
> > The text attribute, on getting, must return UTF-16 text converted
> > from data of thetext track cue that the TextTrackCue object
> > represents. If a conversion of the content in data is not possible,
> > e.g. because the UA is unable to identify the encoding, it must
> > return null.
> 
> So shouldn't the WebIDL say "DOMString?" with a question mark to
> indicate that it's nullable?
> 
> The other question is, is there a general rule where we take a copy of
> objects in constructors? Otherwise we get weird behavior like this:
> 
> > > buf = new ArrayBuffer(4)
> > < ArrayBuffer
> > 
> > > bufView = new Uint16Array(buf)
> > < [0, 0]
> > > bufView[0] = "hi".charCodeAt(0=)
> > < 104
> > > bufView[1] = "hi".charCodeAt(1)
> > < 105
> > 
> > > cue = new DataCue(1, 2, buf)
> > < DataCue
> > 
> > > cue.text
> > < "hi"
> > > bufView[0] = "no".charCodeAt(0)
> > < 110
> > > bufView[1] = "no".charCodeAt(1)
> > < 111
> > > cue.text
> > < "no"
> 
> I'm not sure if I was implementing this wrong, or if we need to change
> the spec to specify that .data is a copy of the ArrayBuffer we give
> it.

--=-+iu3/BwY3ZrBQb7Hw8Eu
Content-Type: text/html; charset="utf-8"
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 TRANSITIONAL//EN">
<HTML>
<HEAD>
  <META HTTP-EQUIV="Content-Type" CONTENT="text/html; CHARSET=UTF-8">
  <META NAME="GENERATOR" CONTENT="GtkHTML/4.6.6">
</HEAD>
<BODY>
On Sat, 2014-02-15 at 13:40 +1100, Silvia Pfeiffer wrote:
<BLOCKQUOTE TYPE=CITE>
<PRE>
On Tue, Feb 11, 2014 at 8:51 AM, Brendan Long &lt;<A HREF="mailto:self@brendanlong.com">self@brendanlong.com</A>&gt; wrote:
<FONT COLOR="#737373">&gt; I think I was reading this too fast and missed this, which seems to apply</FONT>
<FONT COLOR="#737373">&gt; already:</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; If text track list of cues' associated rules for updating the text track</FONT>
<FONT COLOR="#737373">&gt; rendering are not the same rules for updating the text track rendering as</FONT>
<FONT COLOR="#737373">&gt; appropriate for cue, then throw an InvalidStateError exception and abort</FONT>
<FONT COLOR="#737373">&gt; these steps.</FONT>
<FONT COLOR="#737373">&gt;</FONT>
<FONT COLOR="#737373">&gt; Sorry for the list-spam.</FONT>

I'm a bit confused. Do you still have any open questions?
</PRE>
</BLOCKQUOTE>
<BR>
I'm still wondering about my original two questions:<BR>
<BR>
<BLOCKQUOTE TYPE=CITE>
    According to this, .text can be null:<BR>
    <BLOCKQUOTE TYPE=CITE>
        The&nbsp;<TT>text</TT>&nbsp;attribute, on getting, must return UTF-16 text converted from&nbsp;<TT><A HREF="http://www.w3.org/html/wg/drafts/html/CR/text-level-semantics.html#the-data-element">data</A></TT>&nbsp;of the<A HREF="http://www.w3.org/html/wg/drafts/html/CR/embedded-content-0.html#text-track-cue">text track cue</A>&nbsp;that the&nbsp;<TT><A HREF="http://www.w3.org/html/wg/drafts/html/CR/embedded-content-0.html#texttrackcue">TextTrackCue</A></TT>&nbsp;object represents. If a conversion of the content in&nbsp;<TT><A HREF="http://www.w3.org/html/wg/drafts/html/CR/text-level-semantics.html#the-data-element">data</A></TT>&nbsp;is not possible, e.g. because the UA is unable to identify the encoding, it must return null.<BR>
    </BLOCKQUOTE>
    So shouldn't the WebIDL say &quot;DOMString?&quot; with a question mark&nbsp;<A HREF="http://www.w3.org/TR/WebIDL/">to indicate that it's nullable</A>?<BR>
    <BR>
    The other question is, is there a general rule where we take a copy of objects in constructors? Otherwise we get weird behavior like this:
    <BLOCKQUOTE TYPE=CITE>
<PRE>
&gt; buf = new ArrayBuffer(4)
&lt; ArrayBuffer

&gt; bufView = new Uint16Array(buf)
&lt; [0, 0]
&gt; bufView[0] = &quot;hi&quot;.charCodeAt(0=)
&lt; 104
&gt; bufView[1] = &quot;hi&quot;.charCodeAt(1)
&lt; 105

&gt; cue = new DataCue(1, 2, buf)
&lt; DataCue

&gt; cue.text
&lt; &quot;hi&quot;
&gt; bufView[0] = &quot;no&quot;.charCodeAt(0)
&lt; 110
&gt; bufView[1] = &quot;no&quot;.charCodeAt(1)
&lt; 111
&gt; cue.text
&lt; &quot;no&quot;
</PRE>
    </BLOCKQUOTE>
    I'm not sure if I was implementing this wrong, or if we need to change the spec to specify that .data is a copy of the ArrayBuffer we give it.
</BLOCKQUOTE>
</BODY>
</HTML>

--=-+iu3/BwY3ZrBQb7Hw8Eu--
Received on Saturday, 15 February 2014 03:31:41 UTC

This archive was generated by hypermail 2.3.1 : Thursday, 29 October 2015 10:16:37 UTC