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

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 2456993003: Improve caption button behavior for video player. (Closed)
Patch Set: Addresss feedback Created 4 years, 1 month 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
« no previous file with comments | « third_party/WebKit/Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
3 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. 3 * Copyright (C) 2011, 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 16 matching lines...) Expand all
27 #include "core/html/shadow/MediaControls.h" 27 #include "core/html/shadow/MediaControls.h"
28 28
29 #include "bindings/core/v8/ExceptionStatePlaceholder.h" 29 #include "bindings/core/v8/ExceptionStatePlaceholder.h"
30 #include "core/dom/ClientRect.h" 30 #include "core/dom/ClientRect.h"
31 #include "core/dom/Fullscreen.h" 31 #include "core/dom/Fullscreen.h"
32 #include "core/events/MouseEvent.h" 32 #include "core/events/MouseEvent.h"
33 #include "core/frame/Settings.h" 33 #include "core/frame/Settings.h"
34 #include "core/html/HTMLMediaElement.h" 34 #include "core/html/HTMLMediaElement.h"
35 #include "core/html/shadow/MediaControlsWindowEventListener.h" 35 #include "core/html/shadow/MediaControlsWindowEventListener.h"
36 #include "core/html/track/TextTrackContainer.h" 36 #include "core/html/track/TextTrackContainer.h"
37 #include "core/html/track/TextTrackList.h"
37 #include "core/layout/LayoutObject.h" 38 #include "core/layout/LayoutObject.h"
38 #include "core/layout/LayoutTheme.h" 39 #include "core/layout/LayoutTheme.h"
39 #include "platform/EventDispatchForbiddenScope.h" 40 #include "platform/EventDispatchForbiddenScope.h"
40 41
41 namespace blink { 42 namespace blink {
42 43
43 // If you change this value, then also update the corresponding value in 44 // If you change this value, then also update the corresponding value in
44 // LayoutTests/media/media-controls.js. 45 // LayoutTests/media/media-controls.js.
45 static const double timeWithoutMouseMovementBeforeHidingMediaControls = 3; 46 static const double timeWithoutMouseMovementBeforeHidingMediaControls = 3;
46 47
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 m_textTrackList->setVisible(false); 550 m_textTrackList->setVisible(false);
550 return; 551 return;
551 } 552 }
552 553
553 if (!m_textTrackList->isWanted()) 554 if (!m_textTrackList->isWanted())
554 m_windowEventListener->start(); 555 m_windowEventListener->start();
555 556
556 m_textTrackList->setVisible(!m_textTrackList->isWanted()); 557 m_textTrackList->setVisible(!m_textTrackList->isWanted());
557 } 558 }
558 559
560 void MediaControls::showTextTrackAtIndex(unsigned indexToEnable) {
561 TextTrackList* trackList = mediaElement().textTracks();
562 if (indexToEnable >= trackList->length())
563 return;
564 TextTrack* track = trackList->anonymousIndexedGetter(indexToEnable);
565 if (track && track->canBeRendered())
566 track->setMode(TextTrack::showingKeyword());
567 }
568
569 void MediaControls::disableShowingTextTracks() {
570 TextTrackList* trackList = mediaElement().textTracks();
571 for (unsigned i = 0; i < trackList->length(); ++i) {
572 TextTrack* track = trackList->anonymousIndexedGetter(i);
573 if (track->mode() == TextTrack::showingKeyword())
574 track->setMode(TextTrack::disabledKeyword());
575 }
576 }
577
559 void MediaControls::refreshCastButtonVisibility() { 578 void MediaControls::refreshCastButtonVisibility() {
560 refreshCastButtonVisibilityWithoutUpdate(); 579 refreshCastButtonVisibilityWithoutUpdate();
561 BatchedControlUpdate batch(this); 580 BatchedControlUpdate batch(this);
562 } 581 }
563 582
564 void MediaControls::refreshCastButtonVisibilityWithoutUpdate() { 583 void MediaControls::refreshCastButtonVisibilityWithoutUpdate() {
565 if (!shouldShowCastButton(mediaElement())) { 584 if (!shouldShowCastButton(mediaElement())) {
566 m_castButton->setIsWanted(false); 585 m_castButton->setIsWanted(false);
567 m_overlayCastButton->setIsWanted(false); 586 m_overlayCastButton->setIsWanted(false);
568 return; 587 return;
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 visitor->trace(m_textTrackList); 938 visitor->trace(m_textTrackList);
920 visitor->trace(m_overflowMenu); 939 visitor->trace(m_overflowMenu);
921 visitor->trace(m_overflowList); 940 visitor->trace(m_overflowList);
922 visitor->trace(m_castButton); 941 visitor->trace(m_castButton);
923 visitor->trace(m_overlayCastButton); 942 visitor->trace(m_overlayCastButton);
924 visitor->trace(m_windowEventListener); 943 visitor->trace(m_windowEventListener);
925 HTMLDivElement::trace(visitor); 944 HTMLDivElement::trace(visitor);
926 } 945 }
927 946
928 } // namespace blink 947 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698