Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: Source/core/html/shadow/MediaControlElements.cpp

Issue 1156993013: New media playback UI. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: minor decrufting. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 66
67 // Sliders (the volume control and timeline) need to capture some additional eve nts used when dragging the thumb. 67 // Sliders (the volume control and timeline) need to capture some additional eve nts used when dragging the thumb.
68 static bool isUserInteractionEventForSlider(Event* event) 68 static bool isUserInteractionEventForSlider(Event* event)
69 { 69 {
70 const AtomicString& type = event->type(); 70 const AtomicString& type = event->type();
71 return type == EventTypeNames::mousedown 71 return type == EventTypeNames::mousedown
72 || type == EventTypeNames::mouseup 72 || type == EventTypeNames::mouseup
73 || type == EventTypeNames::click 73 || type == EventTypeNames::click
74 || type == EventTypeNames::dblclick 74 || type == EventTypeNames::dblclick
75 || type == EventTypeNames::mouseover 75 || type == EventTypeNames::mouseover
76 || type == EventTypeNames::mouseout 76 || type == EventTypeNames::mouseout
liberato (no reviews please) 2015/07/27 20:26:08 this is the cause of the "takes a while to hide th
philipj_slow 2015/07/28 15:23:48 That makes sense. I made a demo for myself to see
philipj_slow 2015/08/03 13:52:34 Were you able to figure out if the change is neede
liberato (no reviews please) 2015/08/04 15:07:00 i'm unable to convince myself. rather than breaki
77 || type == EventTypeNames::mousemove 77 || type == EventTypeNames::mousemove
78 || event->isKeyboardEvent() 78 || event->isKeyboardEvent()
79 || event->isTouchEvent(); 79 || event->isTouchEvent();
80 } 80 }
81 81
82 82
83 MediaControlPanelElement::MediaControlPanelElement(MediaControls& mediaControls) 83 MediaControlPanelElement::MediaControlPanelElement(MediaControls& mediaControls)
84 : MediaControlDivElement(mediaControls, MediaControlsPanel) 84 : MediaControlDivElement(mediaControls, MediaControlsPanel)
85 , m_isDisplayed(false) 85 , m_isDisplayed(false)
86 , m_opaque(true) 86 , m_opaque(true)
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698