| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void changedClosedCaptionsVisibility(); | 60 void changedClosedCaptionsVisibility(); |
| 61 void refreshClosedCaptionsButtonVisibility(); | 61 void refreshClosedCaptionsButtonVisibility(); |
| 62 | 62 |
| 63 void enteredFullscreen(); | 63 void enteredFullscreen(); |
| 64 void exitedFullscreen(); | 64 void exitedFullscreen(); |
| 65 | 65 |
| 66 void startedCasting(); | 66 void startedCasting(); |
| 67 void stoppedCasting(); | 67 void stoppedCasting(); |
| 68 void refreshCastButtonVisibility(); | 68 void refreshCastButtonVisibility(); |
| 69 void showOverlayCastButton(); | 69 void showOverlayCastButton(); |
| 70 // Update cast button visibility, but don't try to update our panel |
| 71 // button visibility for space. |
| 72 void refreshCastButtonVisibilityWithoutUpdate(); |
| 73 |
| 70 | 74 |
| 71 void mediaElementFocused(); | 75 void mediaElementFocused(); |
| 72 | 76 |
| 73 // Returns the layout object for the part of the controls that should be | 77 // Returns the layout object for the part of the controls that should be |
| 74 // used for overlap checking during text track layout. May be null. | 78 // used for overlap checking during text track layout. May be null. |
| 75 LayoutObject* layoutObjectForTextTrackLayout(); | 79 LayoutObject* layoutObjectForTextTrackLayout(); |
| 76 | 80 |
| 81 // Notify us that our controls enclosure has changed width. |
| 82 void notifyPanelWidthChanged(int panelWidth); |
| 83 |
| 77 DECLARE_VIRTUAL_TRACE(); | 84 DECLARE_VIRTUAL_TRACE(); |
| 78 | 85 |
| 79 private: | 86 private: |
| 80 explicit MediaControls(HTMLMediaElement&); | 87 explicit MediaControls(HTMLMediaElement&); |
| 81 | 88 |
| 82 void initializeControls(); | 89 void initializeControls(); |
| 83 | 90 |
| 84 void makeOpaque(); | 91 void makeOpaque(); |
| 85 void makeTransparent(); | 92 void makeTransparent(); |
| 86 | 93 |
| 87 void updatePlayState(); | 94 void updatePlayState(); |
| 88 | 95 |
| 89 enum HideBehaviorFlags { | 96 enum HideBehaviorFlags { |
| 90 IgnoreNone = 0, | 97 IgnoreNone = 0, |
| 91 IgnoreVideoHover = 1 << 0, | 98 IgnoreVideoHover = 1 << 0, |
| 92 IgnoreFocus = 1 << 1, | 99 IgnoreFocus = 1 << 1, |
| 93 IgnoreControlsHover = 1 << 2 | 100 IgnoreControlsHover = 1 << 2 |
| 94 }; | 101 }; |
| 95 | 102 |
| 96 bool shouldHideMediaControls(unsigned behaviorFlags = 0) const; | 103 bool shouldHideMediaControls(unsigned behaviorFlags = 0) const; |
| 97 void hideMediaControlsTimerFired(Timer<MediaControls>*); | 104 void hideMediaControlsTimerFired(Timer<MediaControls>*); |
| 98 void startHideMediaControlsTimer(); | 105 void startHideMediaControlsTimer(); |
| 99 void stopHideMediaControlsTimer(); | 106 void stopHideMediaControlsTimer(); |
| 100 void resetHideMediaControlsTimer(); | 107 void resetHideMediaControlsTimer(); |
| 101 | 108 |
| 102 // Attempts to show the overlay cast button. If it is covered by another | 109 // Attempts to show the overlay cast button. If it is covered by another |
| 103 // element in the page, it will be hidden. | 110 // element in the page, it will be hidden. |
| 104 void tryShowOverlayCastButton(); | 111 void tryShowOverlayCastButton(); |
| 105 | 112 |
| 113 // After changing the want / don't want state of one or more controls, |
| 114 // call this to recompute what's visible. |
| 115 void changedControlSelections(); |
| 116 |
| 117 void panelWidthChangedTimerFired(Timer<MediaControls>*); |
| 118 |
| 119 // Hide elements that don't fit, and show those things that we want which |
| 120 // do fit. This requires that m_panelWidth is current. |
| 121 void computeWhichControlsFit(); |
| 122 |
| 106 // Node | 123 // Node |
| 107 bool isMediaControls() const override { return true; } | 124 bool isMediaControls() const override { return true; } |
| 108 bool willRespondToMouseMoveEvents() override { return true; } | 125 bool willRespondToMouseMoveEvents() override { return true; } |
| 109 void defaultEventHandler(Event*) override; | 126 void defaultEventHandler(Event*) override; |
| 110 bool containsRelatedTarget(Event*); | 127 bool containsRelatedTarget(Event*); |
| 111 | 128 |
| 112 RawPtrWillBeMember<HTMLMediaElement> m_mediaElement; | 129 RawPtrWillBeMember<HTMLMediaElement> m_mediaElement; |
| 113 | 130 |
| 114 // Media control elements. | 131 // Media control elements. |
| 115 RawPtrWillBeMember<MediaControlOverlayEnclosureElement> m_overlayEnclosure; | 132 RawPtrWillBeMember<MediaControlOverlayEnclosureElement> m_overlayEnclosure; |
| 116 RawPtrWillBeMember<MediaControlOverlayPlayButtonElement> m_overlayPlayButton
; | 133 RawPtrWillBeMember<MediaControlOverlayPlayButtonElement> m_overlayPlayButton
; |
| 117 RawPtrWillBeMember<MediaControlCastButtonElement> m_overlayCastButton; | 134 RawPtrWillBeMember<MediaControlCastButtonElement> m_overlayCastButton; |
| 118 RawPtrWillBeMember<MediaControlPanelEnclosureElement> m_enclosure; | 135 RawPtrWillBeMember<MediaControlPanelEnclosureElement> m_enclosure; |
| 119 RawPtrWillBeMember<MediaControlPanelElement> m_panel; | 136 RawPtrWillBeMember<MediaControlPanelElement> m_panel; |
| 120 RawPtrWillBeMember<MediaControlPlayButtonElement> m_playButton; | 137 RawPtrWillBeMember<MediaControlPlayButtonElement> m_playButton; |
| 121 RawPtrWillBeMember<MediaControlTimelineElement> m_timeline; | 138 RawPtrWillBeMember<MediaControlTimelineElement> m_timeline; |
| 122 RawPtrWillBeMember<MediaControlCurrentTimeDisplayElement> m_currentTimeDispl
ay; | 139 RawPtrWillBeMember<MediaControlCurrentTimeDisplayElement> m_currentTimeDispl
ay; |
| 123 RawPtrWillBeMember<MediaControlTimeRemainingDisplayElement> m_durationDispla
y; | 140 RawPtrWillBeMember<MediaControlTimeRemainingDisplayElement> m_durationDispla
y; |
| 124 RawPtrWillBeMember<MediaControlMuteButtonElement> m_muteButton; | 141 RawPtrWillBeMember<MediaControlMuteButtonElement> m_muteButton; |
| 125 RawPtrWillBeMember<MediaControlVolumeSliderElement> m_volumeSlider; | 142 RawPtrWillBeMember<MediaControlVolumeSliderElement> m_volumeSlider; |
| 126 RawPtrWillBeMember<MediaControlToggleClosedCaptionsButtonElement> m_toggleCl
osedCaptionsButton; | 143 RawPtrWillBeMember<MediaControlToggleClosedCaptionsButtonElement> m_toggleCl
osedCaptionsButton; |
| 127 RawPtrWillBeMember<MediaControlCastButtonElement> m_castButton; | 144 RawPtrWillBeMember<MediaControlCastButtonElement> m_castButton; |
| 128 RawPtrWillBeMember<MediaControlFullscreenButtonElement> m_fullScreenButton; | 145 RawPtrWillBeMember<MediaControlFullscreenButtonElement> m_fullScreenButton; |
| 129 | 146 |
| 130 Timer<MediaControls> m_hideMediaControlsTimer; | 147 Timer<MediaControls> m_hideMediaControlsTimer; |
| 131 unsigned m_hideTimerBehaviorFlags; | 148 unsigned m_hideTimerBehaviorFlags; |
| 132 bool m_isMouseOverControls : 1; | 149 bool m_isMouseOverControls : 1; |
| 133 bool m_isPausedForScrubbing : 1; | 150 bool m_isPausedForScrubbing : 1; |
| 151 |
| 152 Timer<MediaControls> m_panelWidthChangedTimer; |
| 153 int m_panelWidth; |
| 134 }; | 154 }; |
| 135 | 155 |
| 136 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls()); | 156 DEFINE_ELEMENT_TYPE_CASTS(MediaControls, isMediaControls()); |
| 137 | 157 |
| 138 } | 158 } |
| 139 | 159 |
| 140 #endif | 160 #endif |
| OLD | NEW |