OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
728 // 10. For each text track cue cue in cues that has not yet had | 728 // 10. For each text track cue cue in cues that has not yet had |
729 // corresponding CSS boxes added to output, in text track cue order, run the | 729 // corresponding CSS boxes added to output, in text track cue order, run the |
730 // following substeps: | 730 // following substeps: |
731 for (size_t i = 0; i < activeCues.size(); ++i) { | 731 for (size_t i = 0; i < activeCues.size(); ++i) { |
732 TextTrackCue* cue = activeCues[i].data(); | 732 TextTrackCue* cue = activeCues[i].data(); |
733 | 733 |
734 ASSERT(cue->isActive()); | 734 ASSERT(cue->isActive()); |
735 if (!cue->track() || !cue->track()->isRendered() || !cue->isActive()) | 735 if (!cue->track() || !cue->track()->isRendered() || !cue->isActive()) |
736 continue; | 736 continue; |
737 | 737 |
738 RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree(m_videoDisplayS
ize.size()); | 738 cue->updateDisplay(m_videoDisplaySize.size(), *this); |
739 VTTRegion* region = 0; | |
740 if (cue->track()->regions()) | |
741 region = cue->track()->regions()->getRegionById(cue->regionId()); | |
742 | |
743 if (!region) { | |
744 // If cue has an empty text track cue region identifier or there is
no | |
745 // WebVTT region whose region identifier is identical to cue's text | |
746 // track cue region identifier, run the following substeps: | |
747 if (displayBox->hasChildNodes() && !contains(displayBox.get())) | |
748 // Note: the display tree of a cue is removed when the active fl
ag of the cue is unset. | |
749 appendChild(displayBox); | |
750 } else { | |
751 // Let region be the WebVTT region whose region identifier | |
752 // matches the text track cue region identifier of cue. | |
753 RefPtr<HTMLDivElement> regionNode = region->getDisplayTree(document(
)); | |
754 | |
755 // Append the region to the viewport, if it was not already. | |
756 if (!contains(regionNode.get())) | |
757 appendChild(regionNode); | |
758 | |
759 region->appendTextTrackCueBox(displayBox); | |
760 } | |
761 } | 739 } |
762 | 740 |
763 // 11. Return output. | 741 // 11. Return output. |
764 if (hasChildNodes()) | 742 if (hasChildNodes()) |
765 show(); | 743 show(); |
766 else | 744 else |
767 hide(); | 745 hide(); |
768 } | 746 } |
769 | 747 |
770 void MediaControlTextTrackContainerElement::updateSizes(bool forceUpdate) | 748 void MediaControlTextTrackContainerElement::updateSizes(bool forceUpdate) |
(...skipping 20 matching lines...) Expand all Loading... |
791 float fontSize = smallestDimension * 0.05f; | 769 float fontSize = smallestDimension * 0.05f; |
792 if (fontSize != m_fontSize) { | 770 if (fontSize != m_fontSize) { |
793 m_fontSize = fontSize; | 771 m_fontSize = fontSize; |
794 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); | 772 setInlineStyleProperty(CSSPropertyFontSize, fontSize, CSSPrimitiveValue:
:CSS_PX); |
795 } | 773 } |
796 } | 774 } |
797 | 775 |
798 // ---------------------------- | 776 // ---------------------------- |
799 | 777 |
800 } // namespace WebCore | 778 } // namespace WebCore |
OLD | NEW |