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_textTrackList(nullptr) | |
62 , m_fullScreenButton(nullptr) | 63 , m_fullScreenButton(nullptr) |
63 , m_castButton(nullptr) | 64 , m_castButton(nullptr) |
64 , m_overlayCastButton(nullptr) | 65 , m_overlayCastButton(nullptr) |
65 , m_durationDisplay(nullptr) | 66 , m_durationDisplay(nullptr) |
66 , m_enclosure(nullptr) | 67 , m_enclosure(nullptr) |
67 , m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired ) | 68 , m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired ) |
68 , m_hideTimerBehaviorFlags(IgnoreNone) | 69 , m_hideTimerBehaviorFlags(IgnoreNone) |
69 , m_isMouseOverControls(false) | 70 , m_isMouseOverControls(false) |
70 , m_isPausedForScrubbing(false) | 71 , m_isPausedForScrubbing(false) |
71 { | 72 { |
(...skipping 16 matching lines...) Expand all Loading... | |
88 // | \-MediaControlCastButtonElement (-internal-media-controls -overlay-cast-button) | 89 // | \-MediaControlCastButtonElement (-internal-media-controls -overlay-cast-button) |
89 // \-MediaControlPanelEnclosureElement (-webkit-media-controls-e nclosure) | 90 // \-MediaControlPanelEnclosureElement (-webkit-media-controls-e nclosure) |
90 // \-MediaControlPanelElement (-webkit-media-controls-p anel) | 91 // \-MediaControlPanelElement (-webkit-media-controls-p anel) |
91 // +-MediaControlPlayButtonElement (-webkit-media-controls-p lay-button) | 92 // +-MediaControlPlayButtonElement (-webkit-media-controls-p lay-button) |
92 // +-MediaControlTimelineElement (-webkit-media-controls-t imeline) | 93 // +-MediaControlTimelineElement (-webkit-media-controls-t imeline) |
93 // +-MediaControlCurrentTimeDisplayElement (-webkit-media-controls-c urrent-time-display) | 94 // +-MediaControlCurrentTimeDisplayElement (-webkit-media-controls-c urrent-time-display) |
94 // +-MediaControlTimeRemainingDisplayElement (-webkit-media-controls-t ime-remaining-display) | 95 // +-MediaControlTimeRemainingDisplayElement (-webkit-media-controls-t ime-remaining-display) |
95 // +-MediaControlMuteButtonElement (-webkit-media-controls-m ute-button) | 96 // +-MediaControlMuteButtonElement (-webkit-media-controls-m ute-button) |
96 // +-MediaControlVolumeSliderElement (-webkit-media-controls-v olume-slider) | 97 // +-MediaControlVolumeSliderElement (-webkit-media-controls-v olume-slider) |
97 // +-MediaControlToggleClosedCaptionsButtonElement (-webkit-media-controls-t oggle-closed-captions-button) | 98 // +-MediaControlToggleClosedCaptionsButtonElement (-webkit-media-controls-t oggle-closed-captions-button) |
99 // +-MediaControlTextTrackListElement (-internal-media-controls -text-track-list) | |
philipj_slow
2015/05/05 14:36:57
Can you also document what the internal structure
srivats
2016/02/23 01:39:27
Done
| |
98 // +-MediaControlCastButtonElement (-internal-media-controls -cast-button) | 100 // +-MediaControlCastButtonElement (-internal-media-controls -cast-button) |
99 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f ullscreen-button) | 101 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f ullscreen-button) |
100 void MediaControls::initializeControls() | 102 void MediaControls::initializeControls() |
101 { | 103 { |
102 RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = M ediaControlOverlayEnclosureElement::create(*this); | 104 RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = M ediaControlOverlayEnclosureElement::create(*this); |
103 | 105 |
104 if (document().settings() && document().settings()->mediaControlsOverlayPlay ButtonEnabled()) { | 106 if (document().settings() && document().settings()->mediaControlsOverlayPlay ButtonEnabled()) { |
105 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButt on = MediaControlOverlayPlayButtonElement::create(*this); | 107 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButt on = MediaControlOverlayPlayButtonElement::create(*this); |
106 m_overlayPlayButton = overlayPlayButton.get(); | 108 m_overlayPlayButton = overlayPlayButton.get(); |
107 overlayEnclosure->appendChild(overlayPlayButton.release()); | 109 overlayEnclosure->appendChild(overlayPlayButton.release()); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 m_castButton = castButton.get(); | 154 m_castButton = castButton.get(); |
153 panel->appendChild(castButton.release()); | 155 panel->appendChild(castButton.release()); |
154 | 156 |
155 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> fullscreenButton = M ediaControlFullscreenButtonElement::create(*this); | 157 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> fullscreenButton = M ediaControlFullscreenButtonElement::create(*this); |
156 m_fullScreenButton = fullscreenButton.get(); | 158 m_fullScreenButton = fullscreenButton.get(); |
157 panel->appendChild(fullscreenButton.release()); | 159 panel->appendChild(fullscreenButton.release()); |
158 | 160 |
159 m_panel = panel.get(); | 161 m_panel = panel.get(); |
160 enclosure->appendChild(panel.release()); | 162 enclosure->appendChild(panel.release()); |
161 | 163 |
164 RefPtrWillBeRawPtr<MediaControlTextTrackListElement> textTrackList = | |
165 MediaControlTextTrackListElement::create(*this); | |
166 m_textTrackList = textTrackList.get(); | |
167 enclosure->appendChild(textTrackList.release()); | |
168 | |
162 m_enclosure = enclosure.get(); | 169 m_enclosure = enclosure.get(); |
163 appendChild(enclosure.release()); | 170 appendChild(enclosure.release()); |
164 } | 171 } |
165 | 172 |
166 void MediaControls::reset() | 173 void MediaControls::reset() |
167 { | 174 { |
168 double duration = mediaElement().duration(); | 175 double duration = mediaElement().duration(); |
169 m_durationDisplay->setInnerText(LayoutTheme::theme().formatMediaControlsTime (duration), ASSERT_NO_EXCEPTION); | 176 m_durationDisplay->setInnerText(LayoutTheme::theme().formatMediaControlsTime (duration), ASSERT_NO_EXCEPTION); |
170 m_durationDisplay->setCurrentValue(duration); | 177 m_durationDisplay->setCurrentValue(duration); |
171 | 178 |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
347 } | 354 } |
348 | 355 |
349 void MediaControls::refreshClosedCaptionsButtonVisibility() | 356 void MediaControls::refreshClosedCaptionsButtonVisibility() |
350 { | 357 { |
351 if (mediaElement().hasClosedCaptions()) | 358 if (mediaElement().hasClosedCaptions()) |
352 m_toggleClosedCaptionsButton->show(); | 359 m_toggleClosedCaptionsButton->show(); |
353 else | 360 else |
354 m_toggleClosedCaptionsButton->hide(); | 361 m_toggleClosedCaptionsButton->hide(); |
355 } | 362 } |
356 | 363 |
364 void MediaControls::toggleTextTrackList() | |
365 { | |
366 if (!mediaElement().hasClosedCaptions()) | |
367 return; | |
368 | |
369 if (m_textTrackList->isVisible()) { | |
370 m_textTrackList->hide(); | |
371 } else { | |
372 m_textTrackList->refreshTextTrackListMenu(); | |
373 m_textTrackList->show(); | |
374 } | |
375 } | |
376 | |
357 static Element* elementFromCenter(Element& element) | 377 static Element* elementFromCenter(Element& element) |
358 { | 378 { |
359 RefPtrWillBeRawPtr<ClientRect> clientRect = element.getBoundingClientRect(); | 379 RefPtrWillBeRawPtr<ClientRect> clientRect = element.getBoundingClientRect(); |
360 int centerX = static_cast<int>((clientRect->left() + clientRect->right()) / 2); | 380 int centerX = static_cast<int>((clientRect->left() + clientRect->right()) / 2); |
361 int centerY = static_cast<int>((clientRect->top() + clientRect->bottom()) / 2); | 381 int centerY = static_cast<int>((clientRect->top() + clientRect->bottom()) / 2); |
362 | 382 |
363 return element.document().elementFromPoint(centerX , centerY); | 383 return element.document().elementFromPoint(centerX , centerY); |
364 } | 384 } |
365 | 385 |
366 void MediaControls::tryShowOverlayCastButton() | 386 void MediaControls::tryShowOverlayCastButton() |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
529 visitor->trace(m_toggleClosedCaptionsButton); | 549 visitor->trace(m_toggleClosedCaptionsButton); |
530 visitor->trace(m_fullScreenButton); | 550 visitor->trace(m_fullScreenButton); |
531 visitor->trace(m_durationDisplay); | 551 visitor->trace(m_durationDisplay); |
532 visitor->trace(m_enclosure); | 552 visitor->trace(m_enclosure); |
533 visitor->trace(m_castButton); | 553 visitor->trace(m_castButton); |
534 visitor->trace(m_overlayCastButton); | 554 visitor->trace(m_overlayCastButton); |
535 HTMLDivElement::trace(visitor); | 555 HTMLDivElement::trace(visitor); |
536 } | 556 } |
537 | 557 |
538 } | 558 } |
OLD | NEW |