Changeset 170694 in webkit


Ignore:
Timestamp:
Jul 1, 2014, 8:35:51 PM (10 years ago)
Author:
eric.carlson@apple.com
Message:

WebVTT percentage value can be a float
https://bugs.webkit.org/show_bug.cgi?id=134511

Reviewed by Brent Fulgham.

Source/WebCore:
No new tests, existing tests modified.

  • html/track/TextTrackCueGeneric.cpp:

(WebCore::TextTrackCueGeneric::setLine): int -> double.
(WebCore::TextTrackCueGeneric::setPosition): Ditto.

  • html/track/TextTrackCueGeneric.h:
  • html/track/VTTCue.cpp:

(WebCore::VTTCue::setLine): Ditto.
(WebCore::VTTCue::setPosition): Ditto.
(WebCore::VTTCue::setCueSettings): Support floating point values for line, position, and size.
(WebCore::scanPercentage): Deleted.

  • html/track/VTTCue.h:
  • html/track/VTTScanner.cpp:

(WebCore::VTTScanner::scanFloat): Support negative values.

  • html/track/VTTScanner.h:
  • html/track/WebVTTParser.cpp: Include parseFloatPercentageValue in non-WEBVTT_REGIONS builds.
  • html/track/WebVTTParser.h:
  • platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:

(WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Drive by change to take a cue

reference rather than a pointer.

(WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Ditto.
(WebCore::InbandTextTrackPrivateAVF::removeCompletedCues): Loop over all cues, don't LOG that

we are asking the client to delete the cue because the client will have already deleted
it when status when to GenericCueData::Complete.

  • platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:

LayoutTests:

  • media/track/captions-webvtt/tc015-positioning-ltr.vtt:
  • media/track/captions-webvtt/tc015-positioning.vtt:
  • media/track/captions-webvtt/tc017-line-position.vtt:
  • media/track/captions-webvtt/tc018-align-text-line-position.vtt:
  • media/track/captions-webvtt/tc019-cue-size.vtt:
  • media/track/track-webvtt-tc015-positioning-expected.txt:
  • media/track/track-webvtt-tc015-positioning.html:
  • media/track/track-webvtt-tc017-line-position-expected.txt:
  • media/track/track-webvtt-tc017-line-position.html:
  • media/track/track-webvtt-tc018-align-text-line-position-expected.txt:
  • media/track/track-webvtt-tc018-align-text-line-position.html:
  • media/video-test.js:

(testCues):

Location:
trunk
Files:
24 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r170691 r170694  
     12014-07-01  Eric Carlson  <eric.carlson@apple.com>
     2
     3        WebVTT percentage value can be a float
     4        https://bugs.webkit.org/show_bug.cgi?id=134511
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * media/track/captions-webvtt/tc015-positioning-ltr.vtt:
     9        * media/track/captions-webvtt/tc015-positioning.vtt:
     10        * media/track/captions-webvtt/tc017-line-position.vtt:
     11        * media/track/captions-webvtt/tc018-align-text-line-position.vtt:
     12        * media/track/captions-webvtt/tc019-cue-size.vtt:
     13        * media/track/track-webvtt-tc015-positioning-expected.txt:
     14        * media/track/track-webvtt-tc015-positioning.html:
     15        * media/track/track-webvtt-tc017-line-position-expected.txt:
     16        * media/track/track-webvtt-tc017-line-position.html:
     17        * media/track/track-webvtt-tc018-align-text-line-position-expected.txt:
     18        * media/track/track-webvtt-tc018-align-text-line-position.html:
     19        * media/video-test.js:
     20        (testCues):
     21
    1222014-07-01  Simon Fraser  <simon.fraser@apple.com>
    223
  • trunk/LayoutTests/media/track/captions-webvtt/tc015-positioning-ltr.vtt

    r112898 r170694  
    88
    992
    10 00:00:31.000 --> 00:00:45.500 position:50%
     1000:00:31.000 --> 00:00:45.500 position:49.20%
    1111قلت الدب قادم!!
    1212تحديد المواقع في منتصف القاع.
  • trunk/LayoutTests/media/track/captions-webvtt/tc015-positioning.vtt

    r112898 r170694  
    88
    992
    10 00:00:31.000 --> 00:00:45.500 position:50%
     1000:00:31.000 --> 00:00:45.500 position:49.20%
    1111I said Bear is coming!!!!
    1212Positioning on the bottom middle.
  • trunk/LayoutTests/media/track/captions-webvtt/tc017-line-position.vtt

    r112898 r170694  
    1313
    14142
    15 00:00:31.000 --> 00:00:45.500 line:50%
     1500:00:31.000 --> 00:00:45.500 line:50.2%
    1616I said Bear is coming!!!!
    1717Positioning on the center of the video.
  • trunk/LayoutTests/media/track/captions-webvtt/tc018-align-text-line-position.vtt

    r112898 r170694  
    1313
    14142
    15 00:00:31.000 --> 00:00:45.500 position:80% line:80%
     1500:00:31.000 --> 00:00:45.500 position:80.3% line:80.08%
    1616I said Bear is coming!!!!
    17 Middle aligned, middle of cue's character is at 80% width and 80% height.
     17Middle aligned, middle of cue's character is at 80.3% width and 80.08% height.
    1818
    191900:00:46.000 --> 00:01:00.500 line:5 align:end position:30%
  • trunk/LayoutTests/media/track/captions-webvtt/tc019-cue-size.vtt

    r112898 r170694  
    1010
    11112
    12 00:00:31.000 --> 00:01:00.500 size:10%
     1200:00:31.000 --> 00:01:00.500 size:10.6%
    1313I said Bear is coming!!!!
    14 Box for the cue is 10% of the video viewport width, which will mean that automatic line wrapping will happen.
     14Box for the cue is 10.6% of the video viewport width, which will mean that automatic line wrapping will happen.
    1515
    16163
  • trunk/LayoutTests/media/track/track-webvtt-tc015-positioning-expected.txt

    r158743 r170694  
    66EXPECTED (cues.length == '4') OK
    77EXPECTED (cues[0].position == '0') OK
    8 EXPECTED (cues[1].position == '50') OK
     8EXPECTED (cues[1].position == '49.2') OK
    99EXPECTED (cues[2].position == '50') OK
    1010EXPECTED (cues[3].position == '100') OK
     
    1313EXPECTED (cues.length == '4') OK
    1414EXPECTED (cues[0].position == '0') OK
    15 EXPECTED (cues[1].position == '50') OK
     15EXPECTED (cues[1].position == '49.2') OK
    1616EXPECTED (cues[2].position == '50') OK
    1717EXPECTED (cues[3].position == '100') OK
  • trunk/LayoutTests/media/track/track-webvtt-tc015-positioning.html

    r108872 r170694  
    3030                        {
    3131                            property : "position",
    32                             values : [0, 50, 50, 100],
     32                            values : [0, 49.2, 50, 100],
     33                            precision : 2,
    3334                        },
    3435                    ],
  • trunk/LayoutTests/media/track/track-webvtt-tc017-line-position-expected.txt

    r158743 r170694  
    99EXPECTED (cues[1].line == '0') OK
    1010EXPECTED (cues[1].snapToLines == 'true') OK
    11 EXPECTED (cues[2].line == '50') OK
     11EXPECTED (cues[2].line == '50.2') OK
    1212EXPECTED (cues[2].snapToLines == 'false') OK
    1313EXPECTED (cues[3].line == '5') OK
  • trunk/LayoutTests/media/track/track-webvtt-tc017-line-position.html

    r108872 r170694  
    2929                        {
    3030                            property : "line",
    31                             values : [0, 0, 50, 5, 100, -1, 500],
     31                            values : [0, 0, 50.2, 5, 100, -1, 500],
     32                            precision : 2,
    3233                        },
    3334                        {
  • trunk/LayoutTests/media/track/track-webvtt-tc018-align-text-line-position-expected.txt

    r158743 r170694  
    1414EXPECTED (cues[1].snapToLines == 'true') OK
    1515EXPECTED (cues[2].align == 'middle') OK
    16 EXPECTED (cues[2].position == '80') OK
    17 EXPECTED (cues[2].line == '80') OK
     16EXPECTED (cues[2].position == '80.3') OK
     17EXPECTED (cues[2].line == '80.08') OK
    1818EXPECTED (cues[2].snapToLines == 'false') OK
    1919EXPECTED (cues[3].align == 'end') OK
  • trunk/LayoutTests/media/track/track-webvtt-tc018-align-text-line-position.html

    r108872 r170694  
    3434                        {
    3535                            property : "position",
    36                             values : [10, 50, 80, 30, 60],
     36                            values : [10, 50, 80.3, 30, 60],
     37                            precision : 2,
    3738                        },
    3839                        {
    3940                            property : "line",
    40                             values : [0, 0, 80, 5, -3],
     41                            values : [0, 0, 80.08, 5, -3],
     42                            precision : 2,
    4143                        },
    4244                        {
  • trunk/LayoutTests/media/video-test.js

    r163649 r170694  
    320320        for (j = 0; j < expected.tests.length; j++) {
    321321            var test = expected.tests[j];
    322             testExpected("cues[" + i + "]." + test.property, test.values[i]);
     322            var propertyString = "cues[" + i + "]." + test.property;
     323            var propertyValue = eval(propertyString);
     324            if (test["precision"])
     325                propertyValue = propertyValue.toFixed(test["precision"]);
     326            reportExpected(test.values[i] == propertyValue, propertyString, "==", test.values[i], propertyValue)
    323327        }
    324328    }
  • trunk/Source/WebCore/ChangeLog

    r170690 r170694  
     12014-07-01  Eric Carlson  <eric.carlson@apple.com>
     2
     3        WebVTT percentage value can be a float
     4        https://bugs.webkit.org/show_bug.cgi?id=134511
     5
     6        Reviewed by Brent Fulgham.
     7
     8        No new tests, existing tests modified.
     9
     10        * html/track/TextTrackCueGeneric.cpp:
     11        (WebCore::TextTrackCueGeneric::setLine): int -> double.
     12        (WebCore::TextTrackCueGeneric::setPosition): Ditto.
     13        * html/track/TextTrackCueGeneric.h:
     14
     15        * html/track/VTTCue.cpp:
     16        (WebCore::VTTCue::setLine): Ditto.
     17        (WebCore::VTTCue::setPosition):  Ditto.
     18        (WebCore::VTTCue::setCueSettings): Support floating point values for line, position, and size.
     19        (WebCore::scanPercentage): Deleted.
     20        * html/track/VTTCue.h:
     21
     22        * html/track/VTTScanner.cpp:
     23        (WebCore::VTTScanner::scanFloat): Support negative values.
     24        * html/track/VTTScanner.h:
     25
     26        * html/track/WebVTTParser.cpp: Include parseFloatPercentageValue in non-WEBVTT_REGIONS builds.
     27        * html/track/WebVTTParser.h:
     28
     29        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
     30        (WebCore::InbandTextTrackPrivateAVF::processCueAttributes): Drive by change to take a cue
     31            reference rather than a pointer.
     32        (WebCore::InbandTextTrackPrivateAVF::processAttributedStrings): Ditto.
     33        (WebCore::InbandTextTrackPrivateAVF::removeCompletedCues): Loop over all cues, don't LOG that
     34            we are asking the client to delete the cue because the client will have already deleted
     35            it when status when to GenericCueData::Complete.
     36        * platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h:
     37
    1382014-07-01  Simon Fraser  <simon.fraser@apple.com>
    239
  • trunk/Source/WebCore/html/track/TextTrackCueGeneric.cpp

    r170379 r170694  
    122122}
    123123
    124 void TextTrackCueGeneric::setLine(int line, ExceptionCode& ec)
     124void TextTrackCueGeneric::setLine(double line, ExceptionCode& ec)
    125125{
    126126    m_defaultPosition = false;
     
    128128}
    129129
    130 void TextTrackCueGeneric::setPosition(int position, ExceptionCode& ec)
     130void TextTrackCueGeneric::setPosition(double position, ExceptionCode& ec)
    131131{
    132132    m_defaultPosition = false;
  • trunk/Source/WebCore/html/track/TextTrackCueGeneric.h

    r169440 r170694  
    4848    virtual PassRefPtr<VTTCueBox> createDisplayTree() override;
    4949
    50     virtual void setLine(int, ExceptionCode&) override;
    51     virtual void setPosition(int, ExceptionCode&) override;
     50    virtual void setLine(double, ExceptionCode&) override;
     51    virtual void setPosition(double, ExceptionCode&) override;
    5252
    5353    bool useDefaultPosition() const { return m_defaultPosition; }
  • trunk/Source/WebCore/html/track/VTTCue.cpp

    r170379 r170694  
    341341}
    342342
    343 void VTTCue::setLine(int position, ExceptionCode& ec)
     343void VTTCue::setLine(double position, ExceptionCode& ec)
    344344{
    345345    // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-line
     
    361361}
    362362
    363 void VTTCue::setPosition(int position, ExceptionCode& ec)
     363void VTTCue::setPosition(double position, ExceptionCode& ec)
    364364{
    365365    // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-position
     
    892892}
    893893
    894 // Used for 'position' and 'size'.
    895 static bool scanPercentage(VTTScanner& input, const VTTScanner::Run& valueRun, int& number)
    896 {
    897     // 1. If value contains any characters other than U+0025 PERCENT SIGN
    898     //    characters (%) and characters in the range U+0030 DIGIT ZERO (0) to
    899     //    U+0039 DIGIT NINE (9), then jump to the step labeled next setting.
    900     // 2. If value does not contain at least one character in the range U+0030
    901     //    DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump to the step
    902     //    labeled next setting.
    903     if (!input.scanDigits(number))
    904         return false;
    905 
    906     // 3. If any character in value other than the last character is a U+0025
    907     //    PERCENT SIGN character (%), then jump to the step labeled next
    908     //    setting.
    909     // 4. If the last character in value is not a U+0025 PERCENT SIGN character
    910     //    (%), then jump to the step labeled next setting.
    911     if (!input.scan('%') || !input.isAt(valueRun.end()))
    912         return false;
    913 
    914     // 5. Ignoring the trailing percent sign, interpret value as an integer,
    915     //    and let number be that number.
    916     // 6. If number is not in the range 0 ≤ number ≤ 100, then jump to the step
    917     //    labeled next setting.
    918     return number >= 0 && number <= 100;
    919 }
    920 
    921894void VTTCue::setCueSettings(const String& inputString)
    922895{
     
    959932            else if (input.scanRun(valueRun, verticalGrowingRightKeyword()))
    960933                m_writingDirection = VerticalGrowingRight;
     934
     935            else
     936                LOG(Media, "VTTCue::setCueSettings, invalid Vertical");
    961937            break;
    962938        }
    963939        case Line: {
    964             // 1-2 - Collect chars that are either '-', '%', or a digit.
    965             // 1. If value contains any characters other than U+002D HYPHEN-MINUS characters (-), U+0025 PERCENT SIGN
    966             //    characters (%), and characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump
    967             //    to the step labeled next setting.
    968             bool isNegative = input.scan('-');
    969             int linePosition;
    970             unsigned numDigits = input.scanDigits(linePosition);
    971             bool isPercentage = input.scan('%');
    972 
    973             if (!input.isAt(valueRun.end()))
    974                 break;
    975 
    976             // 2. If value does not contain at least one character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
    977             //    NINE (9), then jump to the step labeled next setting.
    978             // 3. If any character in value other than the first character is a U+002D HYPHEN-MINUS character (-), then
    979             //    jump to the step labeled next setting.
    980             // 4. If any character in value other than the last character is a U+0025 PERCENT SIGN character (%), then
    981             //    jump to the step labeled next setting.
    982             // 5. If the first character in value is a U+002D HYPHEN-MINUS character (-) and the last character in value is a
    983             //    U+0025 PERCENT SIGN character (%), then jump to the step labeled next setting.
    984             if (!numDigits || (isPercentage && isNegative))
    985                 break;
    986 
    987             // 6. Ignoring the trailing percent sign, if any, interpret value as a (potentially signed) integer, and
    988             //    let number be that number.
    989             // 7. If the last character in value is a U+0025 PERCENT SIGN character (%), but number is not in the range
    990             //    0 ≤ number ≤ 100, then jump to the step labeled next setting.
    991             // 8. Let cue's text track cue line position be number.
    992             // 9. If the last character in value is a U+0025 PERCENT SIGN character (%), then let cue's text track cue
    993             //    snap-to-lines flag be false. Otherwise, let it be true.
    994             if (isPercentage) {
    995                 if (linePosition < 0 || linePosition > 100)
     940            bool isValid = false;
     941            do {
     942                // 1-2 - Collect chars that are either '-', '%', or a digit.
     943                // 1. If value contains any characters other than U+002D HYPHEN-MINUS characters (-), U+0025 PERCENT SIGN
     944                //    characters (%), and characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump
     945                //    to the step labeled next setting.
     946                float linePosition;
     947                bool isNegative;
     948                if (!input.scanFloat(linePosition, &isNegative))
    996949                    break;
    997950
    998                 // 10 - If '%' then set snap-to-lines flag to false.
    999                 m_snapToLines = false;
    1000             } else {
    1001                 if (isNegative)
    1002                     linePosition = -linePosition;
    1003 
    1004                 m_snapToLines = true;
    1005             }
    1006 
    1007             m_linePosition = linePosition;
     951                bool isPercentage = input.scan('%');
     952                if (!input.isAt(valueRun.end()))
     953                    break;
     954
     955                // 2. If value does not contain at least one character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
     956                //    NINE (9), then jump to the step labeled next setting.
     957                // 3. If any character in value other than the first character is a U+002D HYPHEN-MINUS character (-), then
     958                //    jump to the step labeled next setting.
     959                // 4. If any character in value other than the last character is a U+0025 PERCENT SIGN character (%), then
     960                //    jump to the step labeled next setting.
     961                // 5. If the first character in value is a U+002D HYPHEN-MINUS character (-) and the last character in value is a
     962                //    U+0025 PERCENT SIGN character (%), then jump to the step labeled next setting.
     963                if (isPercentage && isNegative)
     964                    break;
     965
     966                // 6. Ignoring the trailing percent sign, if any, interpret value as a (potentially signed) integer, and
     967                //    let number be that number.
     968                // 7. If the last character in value is a U+0025 PERCENT SIGN character (%), but number is not in the range
     969                //    0 ≤ number ≤ 100, then jump to the step labeled next setting.
     970                // 8. Let cue's text track cue line position be number.
     971                // 9. If the last character in value is a U+0025 PERCENT SIGN character (%), then let cue's text track cue
     972                //    snap-to-lines flag be false. Otherwise, let it be true.
     973                if (isPercentage) {
     974                    if (linePosition < 0 || linePosition > 100)
     975                        break;
     976
     977                    // 10 - If '%' then set snap-to-lines flag to false.
     978                    m_snapToLines = false;
     979                } else {
     980                    if (linePosition - static_cast<int>(linePosition))
     981                        break;
     982
     983                    m_snapToLines = true;
     984                }
     985               
     986                m_linePosition = linePosition;
     987                isValid = true;
     988            } while (0);
     989
     990            if (!isValid)
     991                LOG(Media, "VTTCue::setCueSettings, invalid Line");
     992
    1008993            break;
    1009994        }
    1010995        case Position: {
    1011             int number;
    1012             // Steps 1 - 6.
    1013             if (!scanPercentage(input, valueRun, number))           
    1014                 break;
    1015 
    1016             // 7. Let cue's text track cue text position be number.
    1017             m_textPosition = number;
     996            float position;
     997            if (WebVTTParser::parseFloatPercentageValue(input, position) && input.isAt(valueRun.end()))
     998                m_textPosition = position;
     999            else
     1000                LOG(Media, "VTTCue::setCueSettings, invalid Position");
    10181001            break;
    10191002        }
    10201003        case Size: {
    1021             int number;
    1022             // Steps 1 - 6.
    1023             if (!scanPercentage(input, valueRun, number))           
    1024                 break;
    1025 
    1026             // 7. Let cue's text track cue size be number.
    1027             m_cueSize = number;
     1004            float cueSize;
     1005            if (WebVTTParser::parseFloatPercentageValue(input, cueSize) && input.isAt(valueRun.end()))
     1006                m_cueSize = cueSize;
     1007            else
     1008                LOG(Media, "VTTCue::setCueSettings, invalid Size");
    10281009            break;
    10291010        }
     
    10481029            else if (input.scanRun(valueRun, rightKeyword()))
    10491030                m_cueAlignment = Right;
     1031
     1032            else
     1033                LOG(Media, "VTTCue::setCueSettings, invalid Align");
     1034
    10501035            break;
    10511036        }
  • trunk/Source/WebCore/html/track/VTTCue.h

    r170379 r170694  
    8383    void setSnapToLines(bool);
    8484
    85     int line() const { return m_linePosition; }
    86     virtual void setLine(int, ExceptionCode&);
    87 
    88     int position() const { return m_textPosition; }
    89     virtual void setPosition(int, ExceptionCode&);
     85    double line() const { return m_linePosition; }
     86    virtual void setLine(double, ExceptionCode&);
     87
     88    double position() const { return m_textPosition; }
     89    virtual void setPosition(double, ExceptionCode&);
    9090
    9191    int size() const { return m_cueSize; }
     
    191191    String m_content;
    192192    String m_settings;
    193     int m_linePosition;
    194     int m_computedLinePosition;
    195     int m_textPosition;
     193    double m_linePosition;
     194    double m_computedLinePosition;
     195    double m_textPosition;
    196196    int m_cueSize;
    197197
  • trunk/Source/WebCore/html/track/VTTScanner.cpp

    r166097 r170694  
    141141}
    142142
    143 bool VTTScanner::scanFloat(float& number)
     143bool VTTScanner::scanFloat(float& number, bool* isNegative)
    144144{
     145    bool negative = scan('-');
    145146    Run integerRun = collectWhile<isASCIIDigit>();
     147
    146148    seekTo(integerRun.end());
    147149    Run decimalRun(position(), position(), m_is8Bit);
     
    167169    if (!validNumber)
    168170        number = std::numeric_limits<float>::max();
     171    else if (negative)
     172        number = -number;
     173
     174    if (isNegative)
     175        *isNegative = negative;
     176
    169177    return true;
    170178}
  • trunk/Source/WebCore/html/track/VTTScanner.h

    r166097 r170694  
    128128
    129129    // Scan a floating point value on one of the forms: \d+\.? \d+\.\d+ \.\d+
    130     bool scanFloat(float& number);
     130    bool scanFloat(float& number, bool* isNegative = nullptr);
    131131
    132132protected:
  • trunk/Source/WebCore/html/track/WebVTTParser.cpp

    r170379 r170694  
    5151const unsigned fileIdentifierLength = 6;
    5252
    53 #if ENABLE(WEBVTT_REGIONS)
    5453bool WebVTTParser::parseFloatPercentageValue(VTTScanner& valueScanner, float& percentage)
    5554{
     
    6867}
    6968
     69#if ENABLE(WEBVTT_REGIONS)
    7070bool WebVTTParser::parseFloatPercentageValuePair(VTTScanner& valueScanner, char delimiter, FloatPoint& valuePair)
    7171{
  • trunk/Source/WebCore/html/track/WebVTTParser.h

    r170379 r170694  
    140140    static bool collectTimeStamp(const String&, double&);
    141141
    142 #if ENABLE(WEBVTT_REGIONS)
    143142    // Useful functions for parsing percentage settings.
    144143    static bool parseFloatPercentageValue(VTTScanner& valueScanner, float&);
     144#if ENABLE(WEBVTT_REGIONS)
    145145    static bool parseFloatPercentageValuePair(VTTScanner& valueScanner, char, FloatPoint&);
    146146#endif
  • trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp

    r170384 r170694  
    162162}
    163163
    164 void InbandTextTrackPrivateAVF::processCueAttributes(CFAttributedStringRef attributedString, GenericCueData* cueData)
     164void InbandTextTrackPrivateAVF::processCueAttributes(CFAttributedStringRef attributedString, GenericCueData& cueData)
    165165{
    166166    // Some of the attributes we translate into per-cue WebVTT settings are are repeated on each part of an attributed string so only
     
    212212
    213213                if (CFStringCompare(valueString, kCMTextMarkupAlignmentType_Start, 0) == kCFCompareEqualTo)
    214                     cueData->setAlign(GenericCueData::Start);
     214                    cueData.setAlign(GenericCueData::Start);
    215215                else if (CFStringCompare(valueString, kCMTextMarkupAlignmentType_Middle, 0) == kCFCompareEqualTo)
    216                     cueData->setAlign(GenericCueData::Middle);
     216                    cueData.setAlign(GenericCueData::Middle);
    217217                else if (CFStringCompare(valueString, kCMTextMarkupAlignmentType_End, 0) == kCFCompareEqualTo)
    218                     cueData->setAlign(GenericCueData::End);
     218                    cueData.setAlign(GenericCueData::End);
    219219                else
    220220                    ASSERT_NOT_REACHED();
     
    260260                double line;
    261261                CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &line);
    262                 cueData->setLine(line);
     262                cueData.setLine(line);
    263263                continue;
    264264            }
     
    274274                double position;
    275275                CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &position);
    276                 cueData->setPosition(position);
     276                cueData.setPosition(position);
    277277                continue;
    278278            }
     
    288288                double size;
    289289                CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &size);
    290                 cueData->setSize(size);
     290                cueData.setSize(size);
    291291                continue;
    292292            }
     
    311311                double baseFontSize;
    312312                CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &baseFontSize);
    313                 cueData->setBaseFontSize(baseFontSize);
     313                cueData.setBaseFontSize(baseFontSize);
    314314                continue;
    315315            }
     
    322322                double relativeFontSize;
    323323                CFNumberGetValue(valueNumber, kCFNumberFloat64Type, &relativeFontSize);
    324                 cueData->setRelativeFontSize(relativeFontSize);
     324                cueData.setRelativeFontSize(relativeFontSize);
    325325                continue;
    326326            }
     
    334334                processed |= FontName;
    335335               
    336                 cueData->setFontName(valueString);
     336                cueData.setFontName(valueString);
    337337                continue;
    338338            }
     
    346346                if (!makeRGBA32FromARGBCFArray(arrayValue, color))
    347347                    continue;
    348                 cueData->setForegroundColor(color);
     348                cueData.setForegroundColor(color);
    349349            }
    350350           
     
    357357                if (!makeRGBA32FromARGBCFArray(arrayValue, color))
    358358                    continue;
    359                 cueData->setBackgroundColor(color);
     359                cueData.setBackgroundColor(color);
    360360            }
    361361
     
    368368                if (!makeRGBA32FromARGBCFArray(arrayValue, color))
    369369                    continue;
    370                 cueData->setHighlightColor(color);
     370                cueData.setHighlightColor(color);
    371371            }
    372372        }
     
    378378
    379379    if (content.length())
    380         cueData->setContent(content.toString());
     380        cueData.setContent(content.toString());
    381381}
    382382
     
    404404           
    405405            RefPtr<GenericCueData> cueData = GenericCueData::create();
    406             processCueAttributes(attributedString, cueData.get());
     406            processCueAttributes(attributedString, *cueData.get());
    407407            if (!cueData->content().length())
    408408                continue;
     
    500500    if (client()) {
    501501        long currentCue = m_cues.size() - 1;
    502         for (; currentCue > 0; --currentCue) {
     502        for (; currentCue >= 0; --currentCue) {
    503503            if (m_cues[currentCue]->status() != GenericCueData::Complete)
    504504                continue;
    505505
    506             LOG(Media, "InbandTextTrackPrivateAVF::removeCompletedCues(%p) - removing cue (\"%s\") for time = %.2f, position =  %.2f, line =  %.2f", this, m_cues[currentCue]->content().utf8().data(), m_cues[currentCue]->startTime(), m_cues[currentCue]->position(), m_cues[currentCue]->line());
    507             client()->removeGenericCue(this, m_cues[currentCue].get());
    508506            m_cues.remove(currentCue);
    509507        }
  • trunk/Source/WebCore/platform/graphics/avfoundation/InbandTextTrackPrivateAVF.h

    r170379 r170694  
    7575    InbandTextTrackPrivateAVF(AVFInbandTrackParent*, CueFormat);
    7676
    77     void processCueAttributes(CFAttributedStringRef, GenericCueData*);
     77    void processCueAttributes(CFAttributedStringRef, GenericCueData&);
    7878    void processAttributedStrings(CFArrayRef, double);
    7979    void processNativeSamples(CFArrayRef, double);
Note: See TracChangeset for help on using the changeset viewer.