OLD | NEW |
---|---|
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 , m_mediaElement(&mediaElement) | 52 , m_mediaElement(&mediaElement) |
53 , m_panel(nullptr) | 53 , m_panel(nullptr) |
54 , m_overlayPlayButton(nullptr) | 54 , m_overlayPlayButton(nullptr) |
55 , m_overlayEnclosure(nullptr) | 55 , m_overlayEnclosure(nullptr) |
56 , m_playButton(nullptr) | 56 , m_playButton(nullptr) |
57 , m_currentTimeDisplay(nullptr) | 57 , m_currentTimeDisplay(nullptr) |
58 , m_timeline(nullptr) | 58 , m_timeline(nullptr) |
59 , m_muteButton(nullptr) | 59 , m_muteButton(nullptr) |
60 , m_volumeSlider(nullptr) | 60 , m_volumeSlider(nullptr) |
61 , m_toggleClosedCaptionsButton(nullptr) | 61 , m_toggleClosedCaptionsButton(nullptr) |
62 , m_closedCaptionsTrackListContainer(nullptr) | |
63 , m_closedCaptionsTrackList(nullptr) | |
62 , m_fullScreenButton(nullptr) | 64 , m_fullScreenButton(nullptr) |
63 , m_castButton(nullptr) | 65 , m_castButton(nullptr) |
64 , m_overlayCastButton(nullptr) | 66 , m_overlayCastButton(nullptr) |
65 , m_durationDisplay(nullptr) | 67 , m_durationDisplay(nullptr) |
66 , m_enclosure(nullptr) | 68 , m_enclosure(nullptr) |
67 , m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired ) | 69 , m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired ) |
68 , m_hideTimerBehaviorFlags(IgnoreNone) | 70 , m_hideTimerBehaviorFlags(IgnoreNone) |
69 , m_isMouseOverControls(false) | 71 , m_isMouseOverControls(false) |
70 , m_isPausedForScrubbing(false) | 72 , m_isPausedForScrubbing(false) |
71 { | 73 { |
(...skipping 16 matching lines...) Expand all Loading... | |
88 // | \-MediaControlCastButtonElement (-internal-media-controls -overlay-cast-button) | 90 // | \-MediaControlCastButtonElement (-internal-media-controls -overlay-cast-button) |
89 // \-MediaControlPanelEnclosureElement (-webkit-media-controls-e nclosure) | 91 // \-MediaControlPanelEnclosureElement (-webkit-media-controls-e nclosure) |
90 // \-MediaControlPanelElement (-webkit-media-controls-p anel) | 92 // \-MediaControlPanelElement (-webkit-media-controls-p anel) |
91 // +-MediaControlPlayButtonElement (-webkit-media-controls-p lay-button) | 93 // +-MediaControlPlayButtonElement (-webkit-media-controls-p lay-button) |
92 // +-MediaControlTimelineElement (-webkit-media-controls-t imeline) | 94 // +-MediaControlTimelineElement (-webkit-media-controls-t imeline) |
93 // +-MediaControlCurrentTimeDisplayElement (-webkit-media-controls-c urrent-time-display) | 95 // +-MediaControlCurrentTimeDisplayElement (-webkit-media-controls-c urrent-time-display) |
94 // +-MediaControlTimeRemainingDisplayElement (-webkit-media-controls-t ime-remaining-display) | 96 // +-MediaControlTimeRemainingDisplayElement (-webkit-media-controls-t ime-remaining-display) |
95 // +-MediaControlMuteButtonElement (-webkit-media-controls-m ute-button) | 97 // +-MediaControlMuteButtonElement (-webkit-media-controls-m ute-button) |
96 // +-MediaControlVolumeSliderElement (-webkit-media-controls-v olume-slider) | 98 // +-MediaControlVolumeSliderElement (-webkit-media-controls-v olume-slider) |
97 // +-MediaControlToggleClosedCaptionsButtonElement (-webkit-media-controls-t oggle-closed-captions-button) | 99 // +-MediaControlToggleClosedCaptionsButtonElement (-webkit-media-controls-t oggle-closed-captions-button) |
100 // +-MediaControlClosedCaptionsTrackListContainerElement (-webkit-media-cont rols-closed-captions-track-list-container) | |
101 // +-MediaControlClosedCaptionsTrackListElement (-webkit-media-controls-c losed-captions-track-list) | |
98 // +-MediaControlCastButtonElement (-internal-media-controls -cast-button) | 102 // +-MediaControlCastButtonElement (-internal-media-controls -cast-button) |
99 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f ullscreen-button) | 103 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f ullscreen-button) |
100 void MediaControls::initializeControls() | 104 void MediaControls::initializeControls() |
101 { | 105 { |
102 RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = M ediaControlOverlayEnclosureElement::create(*this); | 106 RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = M ediaControlOverlayEnclosureElement::create(*this); |
103 | 107 |
104 if (document().settings() && document().settings()->mediaControlsOverlayPlay ButtonEnabled()) { | 108 if (document().settings() && document().settings()->mediaControlsOverlayPlay ButtonEnabled()) { |
105 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButt on = MediaControlOverlayPlayButtonElement::create(*this); | 109 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButt on = MediaControlOverlayPlayButtonElement::create(*this); |
106 m_overlayPlayButton = overlayPlayButton.get(); | 110 m_overlayPlayButton = overlayPlayButton.get(); |
107 overlayEnclosure->appendChild(overlayPlayButton.release()); | 111 overlayEnclosure->appendChild(overlayPlayButton.release()); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
141 panel->appendChild(muteButton.release()); | 145 panel->appendChild(muteButton.release()); |
142 | 146 |
143 RefPtrWillBeRawPtr<MediaControlVolumeSliderElement> slider = MediaControlVol umeSliderElement::create(*this); | 147 RefPtrWillBeRawPtr<MediaControlVolumeSliderElement> slider = MediaControlVol umeSliderElement::create(*this); |
144 m_volumeSlider = slider.get(); | 148 m_volumeSlider = slider.get(); |
145 panel->appendChild(slider.release()); | 149 panel->appendChild(slider.release()); |
146 | 150 |
147 RefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> toggleClos edCaptionsButton = MediaControlToggleClosedCaptionsButtonElement::create(*this); | 151 RefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> toggleClos edCaptionsButton = MediaControlToggleClosedCaptionsButtonElement::create(*this); |
148 m_toggleClosedCaptionsButton = toggleClosedCaptionsButton.get(); | 152 m_toggleClosedCaptionsButton = toggleClosedCaptionsButton.get(); |
149 panel->appendChild(toggleClosedCaptionsButton.release()); | 153 panel->appendChild(toggleClosedCaptionsButton.release()); |
150 | 154 |
155 RefPtrWillBeRawPtr<MediaControlClosedCaptionsTrackListContainerElement> clos edCaptionsTrackListContainer = | |
156 MediaControlClosedCaptionsTrackListContainerElement::create(*this); | |
157 m_closedCaptionsTrackListContainer = closedCaptionsTrackListContainer.get(); | |
158 RefPtrWillBeRawPtr<MediaControlClosedCaptionsTrackListElement> closedCaption sTrackList = | |
159 MediaControlClosedCaptionsTrackListElement::create(*this); | |
160 m_closedCaptionsTrackList = closedCaptionsTrackList.get(); | |
161 m_closedCaptionsTrackListContainer->appendChild(closedCaptionsTrackList.rele ase()); | |
162 panel->appendChild(closedCaptionsTrackListContainer.release()); | |
163 | |
151 RefPtrWillBeRawPtr<MediaControlCastButtonElement> castButton = MediaControlC astButtonElement::create(*this, false); | 164 RefPtrWillBeRawPtr<MediaControlCastButtonElement> castButton = MediaControlC astButtonElement::create(*this, false); |
152 m_castButton = castButton.get(); | 165 m_castButton = castButton.get(); |
153 panel->appendChild(castButton.release()); | 166 panel->appendChild(castButton.release()); |
154 | 167 |
155 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> fullscreenButton = M ediaControlFullscreenButtonElement::create(*this); | 168 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> fullscreenButton = M ediaControlFullscreenButtonElement::create(*this); |
156 m_fullScreenButton = fullscreenButton.get(); | 169 m_fullScreenButton = fullscreenButton.get(); |
157 panel->appendChild(fullscreenButton.release()); | 170 panel->appendChild(fullscreenButton.release()); |
158 | 171 |
159 m_panel = panel.get(); | 172 m_panel = panel.get(); |
160 enclosure->appendChild(panel.release()); | 173 enclosure->appendChild(panel.release()); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 } | 360 } |
348 | 361 |
349 void MediaControls::refreshClosedCaptionsButtonVisibility() | 362 void MediaControls::refreshClosedCaptionsButtonVisibility() |
350 { | 363 { |
351 if (mediaElement().hasClosedCaptions()) | 364 if (mediaElement().hasClosedCaptions()) |
352 m_toggleClosedCaptionsButton->show(); | 365 m_toggleClosedCaptionsButton->show(); |
353 else | 366 else |
354 m_toggleClosedCaptionsButton->hide(); | 367 m_toggleClosedCaptionsButton->hide(); |
355 } | 368 } |
356 | 369 |
370 void MediaControls::toggleClosedCaptionsTrackList() | |
371 { | |
372 if (!mediaElement().hasClosedCaptions() || !m_closedCaptionsTrackListContain er) | |
fs
2015/04/14 12:34:57
m_closedCaptionsTrackListContainer is always creat
srivats
2015/04/16 23:37:20
Removed
| |
373 return; | |
374 | |
375 bool isTrackListVisible = m_closedCaptionsTrackListContainer->isVisible(); | |
376 // Media controls panel has overflow set to hidden. To display track list, | |
fs
2015/04/14 12:34:57
Maybe this is an indication that the menu should n
srivats
2015/04/16 23:37:20
Seems logical to be a part of media controls becau
fs
2015/04/17 11:54:46
Well, first, a menu that's part of the page has a
srivats
2015/04/21 01:48:55
Moved it out of media controls panel and added it
| |
377 // overflow has to be set to visible. | |
378 m_panel->setInlineStyleProperty(CSSPropertyOverflow, CSSValueVisible, isTrac kListVisible); | |
379 if (isTrackListVisible) { | |
380 m_closedCaptionsTrackListContainer->hide(); | |
381 m_closedCaptionsTrackList->hide(); | |
382 } else { | |
383 m_closedCaptionsTrackListContainer->show(); | |
384 m_closedCaptionsTrackList->refreshTextTrackListMenu(); | |
385 m_closedCaptionsTrackList->show(); | |
386 } | |
387 } | |
388 | |
357 static Element* elementFromCenter(Element& element) | 389 static Element* elementFromCenter(Element& element) |
358 { | 390 { |
359 RefPtrWillBeRawPtr<ClientRect> clientRect = element.getBoundingClientRect(); | 391 RefPtrWillBeRawPtr<ClientRect> clientRect = element.getBoundingClientRect(); |
360 int centerX = static_cast<int>((clientRect->left() + clientRect->right()) / 2); | 392 int centerX = static_cast<int>((clientRect->left() + clientRect->right()) / 2); |
361 int centerY = static_cast<int>((clientRect->top() + clientRect->bottom()) / 2); | 393 int centerY = static_cast<int>((clientRect->top() + clientRect->bottom()) / 2); |
362 | 394 |
363 return element.document().elementFromPoint(centerX , centerY); | 395 return element.document().elementFromPoint(centerX , centerY); |
364 } | 396 } |
365 | 397 |
366 void MediaControls::tryShowOverlayCastButton() | 398 void MediaControls::tryShowOverlayCastButton() |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 visitor->trace(m_toggleClosedCaptionsButton); | 561 visitor->trace(m_toggleClosedCaptionsButton); |
530 visitor->trace(m_fullScreenButton); | 562 visitor->trace(m_fullScreenButton); |
531 visitor->trace(m_durationDisplay); | 563 visitor->trace(m_durationDisplay); |
532 visitor->trace(m_enclosure); | 564 visitor->trace(m_enclosure); |
533 visitor->trace(m_castButton); | 565 visitor->trace(m_castButton); |
534 visitor->trace(m_overlayCastButton); | 566 visitor->trace(m_overlayCastButton); |
535 HTMLDivElement::trace(visitor); | 567 HTMLDivElement::trace(visitor); |
536 } | 568 } |
537 | 569 |
538 } | 570 } |
OLD | NEW |