RESOLVED FIXED 73466
HTMLTrackElement.readyState should return TextTrack "readiness state".
https://bugs.webkit.org/show_bug.cgi?id=73466
Summary HTMLTrackElement.readyState should return TextTrack "readiness state".
Eric Carlson
Reported 2011-11-30 10:37:31 PST
r101213 (72553) moved the text track 'readyState' attribute from TextTrack to HTMLTrackElement. The attribute and constants do belong on the element, but all types of text tracks - in-band, out of band, and those created with addTextTrack() - must maintain a "text track readiness state" as well. Additionally, HTMLTrackElement.readyState is supposed to return the readiness state of the track element's TextTrack: The readyState attribute must return the numeric value corresponding to the text track readiness state of the track element's text track [1] [1] http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-track-readystate
Attachments
Proposed patch (4.79 KB, patch)
2011-11-30 11:01 PST, Eric Carlson
darin: review+
Radar WebKit Bug Importer
Comment 1 2011-11-30 10:38:06 PST
Eric Carlson
Comment 2 2011-11-30 11:01:01 PST
Created attachment 117225 [details] Proposed patch
Darin Adler
Comment 3 2011-11-30 17:23:55 PST
Comment on attachment 117225 [details] Proposed patch View in context: https://bugs.webkit.org/attachment.cgi?id=117225&action=review This code is OK but I am not happy about having two enums that have to always match. Can we fix that? > Source/WebCore/html/HTMLTrackElement.cpp:223 > + ensureTrack()->setReadinessState(static_cast<TextTrack::ReadinessState>(state)); This cast isn’t safe if we ever change one of the two enums without the other. There’s not even a comment to guarantee we keep them in sync. > Source/WebCore/html/HTMLTrackElement.cpp:230 > + return static_cast<HTMLTrackElement::ReadyState>(ensureTrack()->readinessState()); No need here for HTMLTrackElement:: prefix. This cast isn’t safe if we ever change one of the two enums without the other. There’s not even a comment to guarantee we keep them in sync. > Source/WebCore/html/TextTrack.h:113 > + TextTrack::ReadinessState m_readinessState; There is no need for TextTrack:: prefix here.
Eric Carlson
Comment 4 2011-12-01 08:47:55 PST
(In reply to comment #3) > (From update of attachment 117225 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=117225&action=review > > This code is OK but I am not happy about having two enums that have to always match. Can we fix that? > > > Source/WebCore/html/HTMLTrackElement.cpp:223 > > + ensureTrack()->setReadinessState(static_cast<TextTrack::ReadinessState>(state)); > > This cast isn’t safe if we ever change one of the two enums without the other. There’s not even a comment to guarantee we keep them in sync. > I couldn't come up with a clean way to have just one enum because the enum in HTMLTrackElement.h is visible to JavaScript, and HTMLTrackElement.h has to include TextTrack.h, but I added COMPILE_ASSERTs for all values so HTMLTrackElement.cpp will fail to compile if the two enums ever get out of sync. > > Source/WebCore/html/HTMLTrackElement.cpp:230 > > + return static_cast<HTMLTrackElement::ReadyState>(ensureTrack()->readinessState()); > > No need here for HTMLTrackElement:: prefix. > Fixed. > > Source/WebCore/html/TextTrack.h:113 > > + TextTrack::ReadinessState m_readinessState; > > There is no need for TextTrack:: prefix here. > Fixed.
Eric Carlson
Comment 5 2011-12-01 08:48:14 PST
Note You need to log in before you can comment on or make changes to this bug.