WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
75646
Replace TextTrackCue "getCueAsSource" method with "text" attribute
https://bugs.webkit.org/show_bug.cgi?id=75646
Summary
Replace TextTrackCue "getCueAsSource" method with "text" attribute
Eric Carlson
Reported
2012-01-05 13:05:49 PST
TextTrackCue's 'getCueAsSource' method has been replaced with a mutable 'text' attribute
Attachments
Proposed patch
(43.87 KB, patch)
2012-01-09 21:24 PST
,
Eric Carlson
darin
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Eric Carlson
Comment 1
2012-01-09 21:24:04 PST
Created
attachment 121788
[details]
Proposed patch
Radar WebKit Bug Importer
Comment 2
2012-01-09 21:24:32 PST
<
rdar://problem/10667556
>
Darin Adler
Comment 3
2012-01-10 09:18:27 PST
Comment on
attachment 121788
[details]
Proposed patch View in context:
https://bugs.webkit.org/attachment.cgi?id=121788&action=review
> Source/WebCore/html/TextTrackCue.cpp:331 > + OwnPtr<WebVTTParser> parser = WebVTTParser::create(0, m_scriptExecutionContext); > + m_documentFragment = parser->createDocumentFragmentFromCueText(m_content);
Could we do this without a local variable? Or would that make the line too long?
> Source/WebCore/html/TextTrackCue.h:92 > + String text() const { return m_content; }
Seems we should return const String& here instead of String to avoid a bit of reference count churn.
> Source/WebCore/html/track/WebVTTParser.cpp:252 > + if (!text.length()) > + return 0;
Is it important to optimize the empty string case? Are there other cases we should optimize, such as “all whitespace”?
> Source/WebCore/html/track/WebVTTParser.cpp:272 > + if (!m_currentContent.length()) > + return;
Why is it important to special-case the empty case? Is that a common case?
> Source/WebCore/html/track/WebVTTParser.cpp:274 > + RefPtr<DocumentFragment> attachmentRoot = createDocumentFragmentFromCueText(m_currentContent.toString());
I don’t see a check for 0 here. What guarantees this won’t return 0?
> Source/WebCore/html/track/WebVTTParser.h:92 > + PassRefPtr<DocumentFragment> createDocumentFragmentFromCueText(const String&);
There’s an extra space here after the > character.
Eric Carlson
Comment 4
2012-01-10 13:18:12 PST
(In reply to
comment #3
)
> (From update of
attachment 121788
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=121788&action=review
> > > Source/WebCore/html/TextTrackCue.cpp:331 > > + OwnPtr<WebVTTParser> parser = WebVTTParser::create(0, m_scriptExecutionContext); > > + m_documentFragment = parser->createDocumentFragmentFromCueText(m_content); > > Could we do this without a local variable? Or would that make the line too long? >
Good suggestion, fixed.
> > Source/WebCore/html/TextTrackCue.h:92 > > + String text() const { return m_content; } > > Seems we should return const String& here instead of String to avoid a bit of reference count churn. >
Fixed.
> > Source/WebCore/html/track/WebVTTParser.cpp:252 > > + if (!text.length()) > > + return 0; > > Is it important to optimize the empty string case? Are there other cases we should optimize, such as “all whitespace”? > > > Source/WebCore/html/track/WebVTTParser.cpp:272 > > + if (!m_currentContent.length()) > > + return; > > Why is it important to special-case the empty case? Is that a common case? >
I removed these and found that we have a layout test that checks to make sure no cue is created for an entry without text. I don't see that requirement in the spec, but I am checking with people in the WebVTT community group to see if I am missing something. If it is not a spec requirement, I will write a bug to fix this.
> > Source/WebCore/html/track/WebVTTParser.cpp:274 > > + RefPtr<DocumentFragment> attachmentRoot = createDocumentFragmentFromCueText(m_currentContent.toString()); > > I don’t see a check for 0 here. What guarantees this won’t return 0? >
A NULL fragment should not be a problem.
> > Source/WebCore/html/track/WebVTTParser.h:92 > > + PassRefPtr<DocumentFragment> createDocumentFragmentFromCueText(const String&); > > There’s an extra space here after the > character.
Fixed.
Eric Carlson
Comment 5
2012-01-10 13:18:26 PST
http://trac.webkit.org/changeset/104624
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug