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 setIsWanted(mediaElement().shouldShowControls() && mediaElement().togglePlay
StateWillPlay()); |
312 show(); | |
313 else | |
314 hide(); | |
315 } | 312 } |
316 | 313 |
317 bool MediaControlOverlayPlayButtonElement::keepEventInNode(Event* event) | 314 bool MediaControlOverlayPlayButtonElement::keepEventInNode(Event* event) |
318 { | 315 { |
319 return isUserInteractionEvent(event); | 316 return isUserInteractionEvent(event); |
320 } | 317 } |
321 | 318 |
322 | 319 |
323 // ---------------------------- | 320 // ---------------------------- |
324 | 321 |
325 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB
uttonElement(MediaControls& mediaControls) | 322 MediaControlToggleClosedCaptionsButtonElement::MediaControlToggleClosedCaptionsB
uttonElement(MediaControls& mediaControls) |
326 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) | 323 : MediaControlInputElement(mediaControls, MediaShowClosedCaptionsButton) |
327 { | 324 { |
328 } | 325 } |
329 | 326 |
330 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr
olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) | 327 PassRefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> MediaContr
olToggleClosedCaptionsButtonElement::create(MediaControls& mediaControls) |
331 { | 328 { |
332 RefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> button = a
doptRefWillBeNoop(new MediaControlToggleClosedCaptionsButtonElement(mediaControl
s)); | 329 RefPtrWillBeRawPtr<MediaControlToggleClosedCaptionsButtonElement> button = a
doptRefWillBeNoop(new MediaControlToggleClosedCaptionsButtonElement(mediaControl
s)); |
333 button->ensureUserAgentShadowRoot(); | 330 button->ensureUserAgentShadowRoot(); |
334 button->setType(InputTypeNames::button); | 331 button->setType(InputTypeNames::button); |
335 button->setShadowPseudoId(AtomicString("-webkit-media-controls-toggle-closed
-captions-button", AtomicString::ConstructFromLiteral)); | 332 button->setShadowPseudoId(AtomicString("-webkit-media-controls-toggle-closed
-captions-button", AtomicString::ConstructFromLiteral)); |
336 button->hide(); | 333 button->setIsWanted(false); |
337 return button.release(); | 334 return button.release(); |
338 } | 335 } |
339 | 336 |
340 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() | 337 void MediaControlToggleClosedCaptionsButtonElement::updateDisplayType() |
341 { | 338 { |
342 bool captionsVisible = mediaElement().closedCaptionsVisible(); | 339 bool captionsVisible = mediaElement().closedCaptionsVisible(); |
343 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl
osedCaptionsButton); | 340 setDisplayType(captionsVisible ? MediaHideClosedCaptionsButton : MediaShowCl
osedCaptionsButton); |
344 setChecked(captionsVisible); | 341 setChecked(captionsVisible); |
345 } | 342 } |
346 | 343 |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) | 501 : MediaControlInputElement(mediaControls, MediaEnterFullscreenButton) |
505 { | 502 { |
506 } | 503 } |
507 | 504 |
508 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre
enButtonElement::create(MediaControls& mediaControls) | 505 PassRefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> MediaControlFullscre
enButtonElement::create(MediaControls& mediaControls) |
509 { | 506 { |
510 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil
lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); | 507 RefPtrWillBeRawPtr<MediaControlFullscreenButtonElement> button = adoptRefWil
lBeNoop(new MediaControlFullscreenButtonElement(mediaControls)); |
511 button->ensureUserAgentShadowRoot(); | 508 button->ensureUserAgentShadowRoot(); |
512 button->setType(InputTypeNames::button); | 509 button->setType(InputTypeNames::button); |
513 button->setShadowPseudoId(AtomicString("-webkit-media-controls-fullscreen-bu
tton", AtomicString::ConstructFromLiteral)); | 510 button->setShadowPseudoId(AtomicString("-webkit-media-controls-fullscreen-bu
tton", AtomicString::ConstructFromLiteral)); |
514 button->hide(); | 511 button->setIsWanted(false); |
515 return button.release(); | 512 return button.release(); |
516 } | 513 } |
517 | 514 |
518 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) | 515 void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) |
519 { | 516 { |
520 if (event->type() == EventTypeNames::click) { | 517 if (event->type() == EventTypeNames::click) { |
521 if (mediaElement().isFullscreen()) | 518 if (mediaElement().isFullscreen()) |
522 mediaElement().exitFullscreen(); | 519 mediaElement().exitFullscreen(); |
523 else | 520 else |
524 mediaElement().enterFullscreen(); | 521 mediaElement().enterFullscreen(); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 } | 608 } |
612 | 609 |
613 PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurren
tTimeDisplayElement::create(MediaControls& mediaControls) | 610 PassRefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> MediaControlCurren
tTimeDisplayElement::create(MediaControls& mediaControls) |
614 { | 611 { |
615 RefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> element = adoptRef
WillBeNoop(new MediaControlCurrentTimeDisplayElement(mediaControls)); | 612 RefPtrWillBeRawPtr<MediaControlCurrentTimeDisplayElement> element = adoptRef
WillBeNoop(new MediaControlCurrentTimeDisplayElement(mediaControls)); |
616 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time
-display", AtomicString::ConstructFromLiteral)); | 613 element->setShadowPseudoId(AtomicString("-webkit-media-controls-current-time
-display", AtomicString::ConstructFromLiteral)); |
617 return element.release(); | 614 return element.release(); |
618 } | 615 } |
619 | 616 |
620 } // namespace blink | 617 } // namespace blink |
OLD | NEW |