Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(475)

Side by Side Diff: Source/core/html/shadow/MediaControlElements.cpp

Issue 25798003: Enable WebVTT regions for runtime testing, updated tests and minor fixes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Revert Logging Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 12 matching lines...) Expand all
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 */ 28 */
29 29
30 #include "config.h" 30 #include "config.h"
31 #include "core/html/shadow/MediaControlElements.h" 31 #include "core/html/shadow/MediaControlElements.h"
32 32
33 #include "RuntimeEnabledFeatures.h"
33 #include "bindings/v8/ExceptionStatePlaceholder.h" 34 #include "bindings/v8/ExceptionStatePlaceholder.h"
34 #include "core/dom/DOMTokenList.h" 35 #include "core/dom/DOMTokenList.h"
35 #include "core/events/EventNames.h" 36 #include "core/events/EventNames.h"
36 #include "core/dom/FullscreenElementStack.h" 37 #include "core/dom/FullscreenElementStack.h"
37 #include "core/events/MouseEvent.h" 38 #include "core/events/MouseEvent.h"
38 #include "core/html/HTMLVideoElement.h" 39 #include "core/html/HTMLVideoElement.h"
39 #include "core/html/shadow/MediaControls.h" 40 #include "core/html/shadow/MediaControls.h"
40 #include "core/html/track/TextTrack.h" 41 #include "core/html/track/TextTrack.h"
41 #include "core/html/track/TextTrackRegionList.h" 42 #include "core/html/track/TextTrackRegionList.h"
42 #include "core/page/EventHandler.h" 43 #include "core/page/EventHandler.h"
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 // corresponding CSS boxes added to output, in text track cue order, run the 731 // corresponding CSS boxes added to output, in text track cue order, run the
731 // following substeps: 732 // following substeps:
732 for (size_t i = 0; i < activeCues.size(); ++i) { 733 for (size_t i = 0; i < activeCues.size(); ++i) {
733 TextTrackCue* cue = activeCues[i].data(); 734 TextTrackCue* cue = activeCues[i].data();
734 735
735 ASSERT(cue->isActive()); 736 ASSERT(cue->isActive());
736 if (!cue->track() || !cue->track()->isRendered() || !cue->isActive()) 737 if (!cue->track() || !cue->track()->isRendered() || !cue->isActive())
737 continue; 738 continue;
738 739
739 RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree(m_videoDisplayS ize.size()); 740 RefPtr<TextTrackCueBox> displayBox = cue->getDisplayTree(m_videoDisplayS ize.size());
741 TextTrackRegion* region = 0;
742 if (RuntimeEnabledFeatures::webVTTRegionsEnabled() && cue->track()->regi ons())
743 region = cue->track()->regions()->getRegionById(cue->regionId());
740 744
741 #if ENABLE(WEBVTT_REGIONS) 745 if (!RuntimeEnabledFeatures::webVTTRegionsEnabled() || !region) {
acolwell GONE FROM CHROMIUM 2013/10/04 19:48:20 nit: Isn't the !RuntimeEnabledFeatures::webVTTRegi
vcarbune.chromium 2013/10/08 18:07:38 Correct, I removed it from here and the line above
742 String regionId = cue->regionId();
743 TextTrackRegion* region = cue->track()->regions()->getRegionById(regionI d);
744 if (!region) {
745 // If cue has an empty text track cue region identifier or there is no 746 // If cue has an empty text track cue region identifier or there is no
746 // WebVTT region whose region identifier is identical to cue's text 747 // WebVTT region whose region identifier is identical to cue's text
747 // track cue region identifier, run the following substeps: 748 // track cue region identifier, run the following substeps:
748 #endif 749 if (displayBox->hasChildNodes() && !contains(displayBox.get()))
749 if (displayBox->hasChildNodes() && !contains(displayBox.get())) {
750 // Note: the display tree of a cue is removed when the active fl ag of the cue is unset. 750 // Note: the display tree of a cue is removed when the active fl ag of the cue is unset.
751 appendChild(displayBox); 751 appendChild(displayBox);
752 }
753 #if ENABLE(WEBVTT_REGIONS)
754 } else { 752 } else {
755 // Let region be the WebVTT region whose region identifier 753 // Let region be the WebVTT region whose region identifier
756 // matches the text track cue region identifier of cue. 754 // matches the text track cue region identifier of cue.
757 RefPtr<HTMLDivElement> regionNode = region->getDisplayTree(); 755 RefPtr<HTMLDivElement> regionNode = region->getDisplayTree();
758 756
759 // Append the region to the viewport, if it was not already. 757 // Append the region to the viewport, if it was not already.
760 if (!contains(regionNode.get())) 758 if (!contains(regionNode.get()))
761 appendChild(region->getDisplayTree()); 759 appendChild(region->getDisplayTree());
762 760
763 region->appendTextTrackCueBox(displayBox); 761 region->appendTextTrackCueBox(displayBox);
764 } 762 }
765 #endif
766 } 763 }
767 764
768 // 11. Return output. 765 // 11. Return output.
769 if (hasChildNodes()) 766 if (hasChildNodes())
770 show(); 767 show();
771 else 768 else
772 hide(); 769 hide();
773 } 770 }
774 771
775 void MediaControlTextTrackContainerElement::updateSizes(bool forceUpdate) 772 void MediaControlTextTrackContainerElement::updateSizes(bool forceUpdate)
(...skipping 26 matching lines...) Expand all
802 CueList activeCues = mediaElement->currentlyActiveCues(); 799 CueList activeCues = mediaElement->currentlyActiveCues();
803 for (size_t i = 0; i < activeCues.size(); ++i) { 800 for (size_t i = 0; i < activeCues.size(); ++i) {
804 TextTrackCue* cue = activeCues[i].data(); 801 TextTrackCue* cue = activeCues[i].data();
805 cue->videoSizeDidChange(m_videoDisplaySize.size()); 802 cue->videoSizeDidChange(m_videoDisplaySize.size());
806 } 803 }
807 } 804 }
808 805
809 // ---------------------------- 806 // ----------------------------
810 807
811 } // namespace WebCore 808 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698