OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 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 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
119 | 119 |
120 void MediaControlPanelElement::stopTimer() | 120 void MediaControlPanelElement::stopTimer() |
121 { | 121 { |
122 if (m_transitionTimer.isActive()) | 122 if (m_transitionTimer.isActive()) |
123 m_transitionTimer.stop(); | 123 m_transitionTimer.stop(); |
124 } | 124 } |
125 | 125 |
126 void MediaControlPanelElement::transitionTimerFired(Timer<MediaControlPanelEleme nt>*) | 126 void MediaControlPanelElement::transitionTimerFired(Timer<MediaControlPanelEleme nt>*) |
127 { | 127 { |
128 if (!m_opaque) | 128 if (!m_opaque) |
129 hide(); | 129 setIsWanted(false); |
130 | 130 |
131 stopTimer(); | 131 stopTimer(); |
132 } | 132 } |
133 | 133 |
134 void MediaControlPanelElement::didBecomeVisible() | 134 void MediaControlPanelElement::didBecomeVisible() |
135 { | 135 { |
136 ASSERT(m_isDisplayed && m_opaque); | 136 ASSERT(m_isDisplayed && m_opaque); |
137 mediaElement().mediaControlsDidBecomeVisible(); | 137 mediaElement().mediaControlsDidBecomeVisible(); |
138 } | 138 } |
139 | 139 |
140 void MediaControlPanelElement::makeOpaque() | 140 void MediaControlPanelElement::makeOpaque() |
141 { | 141 { |
142 if (m_opaque) | 142 if (m_opaque) |
143 return; | 143 return; |
144 | 144 |
145 setInlineStyleProperty(CSSPropertyOpacity, 1.0, CSSPrimitiveValue::CSS_NUMBE R); | 145 setInlineStyleProperty(CSSPropertyOpacity, 1.0, CSSPrimitiveValue::CSS_NUMBE R); |
146 m_opaque = true; | 146 m_opaque = true; |
147 | 147 |
148 if (m_isDisplayed) { | 148 if (m_isDisplayed) { |
149 show(); | 149 setIsWanted(true); |
150 didBecomeVisible(); | 150 didBecomeVisible(); |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 void MediaControlPanelElement::makeTransparent() | 154 void MediaControlPanelElement::makeTransparent() |
155 { | 155 { |
156 if (!m_opaque) | 156 if (!m_opaque) |
157 return; | 157 return; |
158 | 158 |
159 setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBE R); | 159 setInlineStyleProperty(CSSPropertyOpacity, 0.0, CSSPrimitiveValue::CSS_NUMBE R); |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
301 { | 301 { |
302 if (event->type() == EventTypeNames::click && mediaElement().togglePlayState WillPlay()) { | 302 if (event->type() == EventTypeNames::click && mediaElement().togglePlayState WillPlay()) { |
303 mediaElement().togglePlayState(); | 303 mediaElement().togglePlayState(); |
304 updateDisplayType(); | 304 updateDisplayType(); |
305 event->setDefaultHandled(); | 305 event->setDefaultHandled(); |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 void MediaControlOverlayPlayButtonElement::updateDisplayType() | 309 void MediaControlOverlayPlayButtonElement::updateDisplayType() |
310 { | 310 { |
311 if (mediaElement().shouldShowControls() && mediaElement().togglePlayStateWil lPlay()) | 311 if (mediaElement().shouldShowControls() && mediaElement().togglePlayStateWil lPlay()) |
philipj_slow
2015/07/09 08:56:10
Transform this into a single call to setIsWanted,
liberato (no reviews please)
2015/07/09 22:35:33
Done.
| |
312 show(); | 312 setIsWanted(true); |
313 else | 313 else |
314 hide(); | 314 setIsWanted(false); |
315 } | 315 } |
316 | 316 |
317 bool MediaControlOverlayPlayButtonElement::keepEventInNode(Event* event) | 317 bool MediaControlOverlayPlayButtonElement::keepEventInNode(Event* event) |
318 { | 318 { |
319 return isUserInteractionEvent(event); | 319 return isUserInteractionEvent(event); |
320 } | 320 } |
321 | 321 |
322 | 322 |
323 // ---------------------------- | 323 // ---------------------------- |
324 | 324 |
325 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB uttonElement(MediaControls& mediaControls) | 325 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB uttonElement(MediaControls& mediaControls) |
326 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) | 326 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) |
327 { | 327 { |
328 } | 328 } |
329 | 329 |
330 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) | 330 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) |
331 { | 331 { |
332 RefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> button = a doptRefWillBeNoop(new MediaControlToggleClosedCaptionsButtonElement(mediaControl s)); | 332 RefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> button = a doptRefWillBeNoop(new MediaControlToggleClosedCaptionsButtonElement(mediaControl s)); |
333 button->ensureUserAgentShadowRoot(); | 333 button->ensureUserAgentShadowRoot(); |
334 button->setType(InputTypeNames::button); | 334 button->setType(InputTypeNames::button); |
335 button->setShadowPseudoId(AtomicString("-webkit-media-controls-toggle-closed -captions-button", AtomicString::ConstructFromLiteral)); | 335 button->setShadowPseudoId(AtomicString("-webkit-media-controls-toggle-closed -captions-button", AtomicString::ConstructFromLiteral)); |
336 button->hide(); | 336 button->setIsWanted(false); |
337 return button.release(); | 337 return button.release(); |
338 } | 338 } |
339 | 339 |
340 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() | 340 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() |
341 { | 341 { |
342 bool captionsVisible = mediaElement().closedCaptionsVisible(); | 342 bool captionsVisible = mediaElement().closedCaptionsVisible(); |
343 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl osedCaptionsButton); | 343 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl osedCaptionsButton); |
344 setChecked(captionsVisible); | 344 setChecked(captionsVisible); |
345 } | 345 } |
346 | 346 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
504 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) | 504 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) |
505 { | 505 { |
506 } | 506 } |
507 | 507 |
508 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre enButtonElement::create(MediaControls& mediaControls) | 508 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre enButtonElement::create(MediaControls& mediaControls) |
509 { | 509 { |
510 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); | 510 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); |
511 button->ensureUserAgentShadowRoot(); | 511 button->ensureUserAgentShadowRoot(); |
512 button->setType(InputTypeNames::button); | 512 button->setType(InputTypeNames::button); |
513 button->setShadowPseudoId(AtomicString("-webkit-media-controls-fullscreen-bu tton", AtomicString::ConstructFromLiteral)); | 513 button->setShadowPseudoId(AtomicString("-webkit-media-controls-fullscreen-bu tton", AtomicString::ConstructFromLiteral)); |
514 button->hide(); | 514 button->setIsWanted(false); |
515 return button.release(); | 515 return button.release(); |
516 } | 516 } |
517 | 517 |
518 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) | 518 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) |
519 { | 519 { |
520 if (event->type() == EventTypeNames::click) { | 520 if (event->type() == EventTypeNames::click) { |
521 if (mediaElement().isFullscreen()) | 521 if (mediaElement().isFullscreen()) |
522 mediaElement().exitFullscreen(); | 522 mediaElement().exitFullscreen(); |
523 else | 523 else |
524 mediaElement().enterFullscreen(); | 524 mediaElement().enterFullscreen(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
611 } | 611 } |
612 | 612 |
613 PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurren tTimeDisplayElement::create(MediaControls& mediaControls) | 613 PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurren tTimeDisplayElement::create(MediaControls& mediaControls) |
614 { | 614 { |
615 RefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> element = adoptRef WillBeNoop(new MediaControlCurrentTimeDisplayElement(mediaControls)); | 615 RefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> element = adoptRef WillBeNoop(new MediaControlCurrentTimeDisplayElement(mediaControls)); |
616 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time -display", AtomicString::ConstructFromLiteral)); | 616 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time -display", AtomicString::ConstructFromLiteral)); |
617 return element.release(); | 617 return element.release(); |
618 } | 618 } |
619 | 619 |
620 } // namespace blink | 620 } // namespace blink |
OLD | NEW |