RESOLVED FIXED 135677
Increase width of caption container if a larger font size is selected from user prefs
https://bugs.webkit.org/show_bug.cgi?id=135677
Summary Increase width of caption container if a larger font size is selected from us...
Roger Fong
Reported 2014-08-06 16:52:25 PDT
If we select a larger caption font size in user prefs we should scale the width percentage up so that we don't end up with really tall caption boxes. <rdar://problem/17905918>
Attachments
patch (7.66 KB, patch)
2014-08-06 16:55 PDT, Roger Fong
no flags
patch (7.57 KB, patch)
2014-08-06 17:17 PDT, Roger Fong
no flags
patch (9.88 KB, patch)
2014-08-07 10:42 PDT, Roger Fong
bfulgham: review-
patch (10.65 KB, patch)
2014-08-07 12:19 PDT, Roger Fong
bfulgham: review+
Roger Fong
Comment 1 2014-08-06 16:55:27 PDT
Created attachment 236151 [details] patch I don't do the same for VTT Cues because I believe some sort of calculation is going that doesn't like it when I forcibly modify the cue box width. This patch solves the problem for 608 cues however, which we are seeing more often for example, on sites like: http://bcoveliveios-i.akamaihd.net/hls/live/207145/374678397001/KTVU_NEWSCAST/index.m3u8
WebKit Commit Bot
Comment 2 2014-08-06 16:57:16 PDT
Attachment 236151 [details] did not pass style-queue: ERROR: Source/WebCore/html/track/TextTrackCueGeneric.cpp:86: Missing spaces around / [whitespace/operators] [3] ERROR: Source/WebCore/html/track/TextTrackCueGeneric.cpp:89: One line control clauses should not use braces. [whitespace/braces] [4] ERROR: Source/WebCore/html/track/TextTrackCueGeneric.cpp:91: One line control clauses should not use braces. [whitespace/braces] [4] Total errors found: 3 in 5 files If any of these errors are false positives, please file a bug against check-webkit-style.
Roger Fong
Comment 3 2014-08-06 17:17:29 PDT
Created attachment 236155 [details] patch style fix
Roger Fong
Comment 4 2014-08-06 19:05:08 PDT
new patch incoming with a fix for webvtt cues as well
Brent Fulgham
Comment 5 2014-08-07 09:32:54 PDT
Comment on attachment 236155 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=236155&action=review > Source/WebCore/html/track/TextTrackCueGeneric.cpp:45 > We should add a comment along the lines of: // This default value must be the same as the one specified in mediaControlsApple.css for -webkit-media-controls-closed-captions-container > Source/WebCore/html/track/TextTrackCueGeneric.cpp:82 > + float authorFontSize = fmax(defaultFontSize, videoSize.height() * cue->baseFontSizeRelativeToVideoHeight() / 100); I think we usually use std::max (or maybe std::max<float>). > Source/WebCore/html/track/TextTrackCueGeneric.cpp:86 > + float multiplier = fmax(1.0, m_fontSizeFromCaptionUserPrefs / authorFontSize); Ditto. > Source/WebCore/html/track/TextTrackCueGeneric.cpp:88 > + setInlineStyleProperty(CSSPropertyWidth, size*multiplier, CSSPrimitiveValue::CSS_PERCENTAGE); Need spaces around the '*' > Source/WebCore/html/track/TextTrackCueGeneric.cpp:90 > + setInlineStyleProperty(CSSPropertyHeight, size*multiplier, CSSPrimitiveValue::CSS_PERCENTAGE); Ditto > Source/WebCore/html/track/VTTCue.h:62 > + virtual void setFontSizeFromCaptionUserPrefs(int fontSize) { m_fontSizeFromCaptionUserPrefs = fontSize; } Is this meant to be overridden? This might not need to be virtual.
Brent Fulgham
Comment 6 2014-08-07 09:51:46 PDT
The current patch is a huge improvement in my test cases. Nice job!
Roger Fong
Comment 7 2014-08-07 10:42:30 PDT
Brent Fulgham
Comment 8 2014-08-07 10:52:57 PDT
Comment on attachment 236195 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=236195&action=review > Source/WebCore/ChangeLog:14 > + Extra space isn't needed. > Source/WebCore/html/track/TextTrackCueGeneric.cpp:80 > + float authorFontSize = fmax(defaultFontSize, videoSize.height() * cue->baseFontSizeRelativeToVideoHeight() / 100); We should be using std::max or maybe std::max<float> here. defaultFontSize should be VTTCueBox::DEFAULT_FONT_SIZE. > Source/WebCore/html/track/TextTrackCueGeneric.cpp:84 > + float multiplier = fmax(1.0, m_fontSizeFromCaptionUserPrefs / authorFontSize); Ditto. > Source/WebCore/html/track/TextTrackCueGeneric.cpp:86 > + setInlineStyleProperty(CSSPropertyWidth, size*multiplier, CSSPrimitiveValue::CSS_PERCENTAGE); Missing spaces around the '*'. > Source/WebCore/html/track/TextTrackCueGeneric.cpp:88 > + setInlineStyleProperty(CSSPropertyHeight, size*multiplier, CSSPrimitiveValue::CSS_PERCENTAGE); Ditto. > Source/WebCore/html/track/VTTCue.cpp:173 > + float multiplier = fmax(1.0, m_fontSizeFromCaptionUserPrefs / defaultFontSize); std::max or std::max<float>, please. VTTCueBox::DEFAULT_FONT_SIZE > Source/WebCore/html/track/VTTCue.cpp:176 > + setInlineStyleProperty(CSSPropertyWidth, static_cast<double>(m_cue.getCSSSize()*multiplier), CSSPrimitiveValue::CSS_PERCENTAGE); Need spaces around the '*'. > Source/WebCore/html/track/VTTCue.cpp:181 > + setInlineStyleProperty(CSSPropertyHeight, static_cast<double>(m_cue.getCSSSize()*multiplier), CSSPrimitiveValue::CSS_PERCENTAGE); Ditto. > Source/WebCore/html/track/VTTCue.h:72 > + static const float defaultFontSize; I think this should be named DEFAULT_FONT_SIZE > Source/WebCore/html/track/VTTCue.h:74 > We should add a comment along the lines of: // This default value must be the same as the one specified in mediaControlsApple.css for -webkit-media-controls-closed-captions-container > Source/WebCore/html/track/VTTCue.h:75 > +const float VTTCueBox::defaultFontSize = 10; ... then this becomes VTTCueBox::DEFAULT_FONT_SIZE
Brent Fulgham
Comment 9 2014-08-07 10:53:41 PDT
Comment on attachment 236195 [details] patch Patch looks great; can you correct the style suggestions and add the comment I asked for? Thanks.
Roger Fong
Comment 10 2014-08-07 12:19:52 PDT
Brent Fulgham
Comment 11 2014-08-07 12:23:30 PDT
Comment on attachment 236206 [details] patch r=me
Roger Fong
Comment 12 2014-08-07 12:36:18 PDT
Mark Lam
Comment 13 2014-08-07 13:59:04 PDT
This change caused some test failures: media/track/track-cue-rendering-horizontal.html media/track/track-cue-rendering-rtl.html The issue is tracked in <https://webkit.org/b/135720>.
Note You need to log in before you can comment on or make changes to this bug.