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
<rdar://problem/10504834>
Created attachment 117225 [details] Proposed patch
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.
(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.
http://trac.webkit.org/changeset/101673