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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 PassRefPtrWillBeRawPtr<MediaControls> MediaControls::create(HTMLMediaElement& me
diaElement) | 74 PassRefPtrWillBeRawPtr<MediaControls> MediaControls::create(HTMLMediaElement& me
diaElement) |
75 { | 75 { |
76 RefPtrWillBeRawPtr<MediaControls> controls = adoptRefWillBeNoop(new MediaCon
trols(mediaElement)); | 76 RefPtrWillBeRawPtr<MediaControls> controls = adoptRefWillBeNoop(new MediaCon
trols(mediaElement)); |
77 | 77 |
78 if (controls->initializeControls()) | 78 if (controls->initializeControls()) |
79 return controls.release(); | 79 return controls.release(); |
80 | 80 |
81 return nullptr; | 81 return nullptr; |
82 } | 82 } |
83 | 83 |
| 84 // The media controls DOM structure looks like: |
| 85 // |
| 86 // MediaControls (-webkit-media-controls) |
| 87 // +-MediaControlOverlayEnclosureElement (-webkit-media-controls-o
verlay-enclosure) |
| 88 // | +-MediaControlTextTrackContainerElement (-webkit-media-text-track
-container) |
| 89 // | | {when text tracks are enabled} |
| 90 // | +-MediaControlOverlayPlayButtonElement (-webkit-media-controls-o
verlay-play-button) |
| 91 // | | {if mediaControlsOverlayPlayButtonEnabled} |
| 92 // | \-MediaControlCastButtonElement (-internal-media-controls
-overlay-cast-button) |
| 93 // \-MediaControlPanelEnclosureElement (-webkit-media-controls-e
nclosure) |
| 94 // \-MediaControlPanelElement (-webkit-media-controls-p
anel) |
| 95 // +-MediaControlPlayButtonElement (-webkit-media-controls-p
lay-button) |
| 96 // +-MediaControlTimelineElement (-webkit-media-controls-t
imeline) |
| 97 // +-MediaControlCurrentTimeDisplayElement (-webkit-media-controls-c
urrent-time-display) |
| 98 // +-MediaControlTimeRemainingDisplayElement (-webkit-media-controls-t
ime-remaining-display) |
| 99 // +-MediaControlMuteButtonElement (-webkit-media-controls-m
ute-button) |
| 100 // +-MediaControlVolumeSliderElement (-webkit-media-controls-v
olume-slider) |
| 101 // +-MediaControlToggleClosedCaptionsButtonElement (-webkit-media-controls-t
oggle-closed-captions-button) |
| 102 // +-MediaControlCastButtonElement (-internal-media-controls
-cast-button) |
| 103 // \-MediaControlFullscreenButtonElement (-webkit-media-controls-f
ullscreen-button) |
| 104 // |
| 105 // Most of the structure is built by MediaControls::initializeControls() - the |
| 106 // exception being MediaControlTextTrackContainerElement which is added |
| 107 // on-demand by MediaControls::createTextTrackDisplay(). |
84 bool MediaControls::initializeControls() | 108 bool MediaControls::initializeControls() |
85 { | 109 { |
86 TrackExceptionState exceptionState; | 110 TrackExceptionState exceptionState; |
87 | 111 |
88 RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = M
ediaControlOverlayEnclosureElement::create(*this); | 112 RefPtrWillBeRawPtr<MediaControlOverlayEnclosureElement> overlayEnclosure = M
ediaControlOverlayEnclosureElement::create(*this); |
89 | 113 |
90 if (document().settings() && document().settings()->mediaControlsOverlayPlay
ButtonEnabled()) { | 114 if (document().settings() && document().settings()->mediaControlsOverlayPlay
ButtonEnabled()) { |
91 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButt
on = MediaControlOverlayPlayButtonElement::create(*this); | 115 RefPtrWillBeRawPtr<MediaControlOverlayPlayButtonElement> overlayPlayButt
on = MediaControlOverlayPlayButtonElement::create(*this); |
92 m_overlayPlayButton = overlayPlayButton.get(); | 116 m_overlayPlayButton = overlayPlayButton.get(); |
93 overlayEnclosure->appendChild(overlayPlayButton.release(), exceptionStat
e); | 117 overlayEnclosure->appendChild(overlayPlayButton.release(), exceptionStat
e); |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 visitor->trace(m_toggleClosedCaptionsButton); | 608 visitor->trace(m_toggleClosedCaptionsButton); |
585 visitor->trace(m_fullScreenButton); | 609 visitor->trace(m_fullScreenButton); |
586 visitor->trace(m_durationDisplay); | 610 visitor->trace(m_durationDisplay); |
587 visitor->trace(m_enclosure); | 611 visitor->trace(m_enclosure); |
588 visitor->trace(m_castButton); | 612 visitor->trace(m_castButton); |
589 visitor->trace(m_overlayCastButton); | 613 visitor->trace(m_overlayCastButton); |
590 HTMLDivElement::trace(visitor); | 614 HTMLDivElement::trace(visitor); |
591 } | 615 } |
592 | 616 |
593 } | 617 } |
OLD | NEW |