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

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

Issue 892963003: Ensure media control goes to transparent(hide) after seek by touch (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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) 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 , m_timeline(nullptr) 58 , m_timeline(nullptr)
59 , m_muteButton(nullptr) 59 , m_muteButton(nullptr)
60 , m_volumeSlider(nullptr) 60 , m_volumeSlider(nullptr)
61 , m_toggleClosedCaptionsButton(nullptr) 61 , m_toggleClosedCaptionsButton(nullptr)
62 , m_fullScreenButton(nullptr) 62 , m_fullScreenButton(nullptr)
63 , m_castButton(nullptr) 63 , m_castButton(nullptr)
64 , m_overlayCastButton(nullptr) 64 , m_overlayCastButton(nullptr)
65 , m_durationDisplay(nullptr) 65 , m_durationDisplay(nullptr)
66 , m_enclosure(nullptr) 66 , m_enclosure(nullptr)
67 , m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired ) 67 , m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired )
68 , m_hideTimerBehaviorFlags(IgnoreNone)
68 , m_isMouseOverControls(false) 69 , m_isMouseOverControls(false)
69 , m_isPausedForScrubbing(false) 70 , m_isPausedForScrubbing(false)
70 , m_wasLastEventTouch(false)
71 { 71 {
72 } 72 }
73 73
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 controls->setShadowPseudoId(AtomicString("-webkit-media-controls", AtomicStr ing::ConstructFromLiteral)); 77 controls->setShadowPseudoId(AtomicString("-webkit-media-controls", AtomicStr ing::ConstructFromLiteral));
78 controls->initializeControls(); 78 controls->initializeControls();
79 return controls.release(); 79 return controls.release();
80 } 80 }
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 431
432 void MediaControls::stoppedCasting() 432 void MediaControls::stoppedCasting()
433 { 433 {
434 m_castButton->setIsPlayingRemotely(false); 434 m_castButton->setIsPlayingRemotely(false);
435 m_overlayCastButton->setIsPlayingRemotely(false); 435 m_overlayCastButton->setIsPlayingRemotely(false);
436 } 436 }
437 437
438 void MediaControls::defaultEventHandler(Event* event) 438 void MediaControls::defaultEventHandler(Event* event)
439 { 439 {
440 HTMLDivElement::defaultEventHandler(event); 440 HTMLDivElement::defaultEventHandler(event);
441 m_wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent() 441 bool wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent()
442 || (event->isMouseEvent() && toMouseEvent(event)->fromTouch()); 442 || (event->isMouseEvent() && toMouseEvent(event)->fromTouch());
443 443
444 if (wasLastEventTouch) {
445 startHideMediaControlsTimer(IgnoreControlsHover);
fs 2015/02/06 15:20:59 unsigned hideBehavior = wasLastEventTouch ? Ignore
william.xie1 2015/02/06 15:45:10 Currently we need to invoke startHideMediaControls
fs 2015/02/06 16:01:59 This could end up starting the timer regardless of
446 }
447
444 if (event->type() == EventTypeNames::mouseover) { 448 if (event->type() == EventTypeNames::mouseover) {
445 if (!containsRelatedTarget(event)) { 449 if (!containsRelatedTarget(event)) {
446 m_isMouseOverControls = true; 450 m_isMouseOverControls = true;
447 if (!mediaElement().togglePlayStateWillPlay()) { 451 if (!mediaElement().togglePlayStateWillPlay()) {
448 makeOpaque(); 452 makeOpaque();
449 if (shouldHideMediaControls()) 453 if (shouldHideMediaControls())
450 startHideMediaControlsTimer(); 454 startHideMediaControlsTimer();
451 } 455 }
452 } 456 }
453 return; 457 return;
(...skipping 16 matching lines...) Expand all
470 startHideMediaControlsTimer(); 474 startHideMediaControlsTimer();
471 return; 475 return;
472 } 476 }
473 } 477 }
474 478
475 void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*) 479 void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*)
476 { 480 {
477 if (mediaElement().togglePlayStateWillPlay()) 481 if (mediaElement().togglePlayStateWillPlay())
478 return; 482 return;
479 483
480 unsigned behaviorFlags = IgnoreFocus | IgnoreVideoHover; 484 unsigned behaviorFlags = m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVide oHover;
481 if (m_wasLastEventTouch) {
482 behaviorFlags |= IgnoreControlsHover;
483 }
484 if (!shouldHideMediaControls(behaviorFlags)) 485 if (!shouldHideMediaControls(behaviorFlags))
485 return; 486 return;
486 487
487 makeTransparent(); 488 makeTransparent();
488 m_overlayCastButton->hide(); 489 m_overlayCastButton->hide();
489 } 490 }
490 491
491 void MediaControls::startHideMediaControlsTimer() 492 void MediaControls::startHideMediaControlsTimer(unsigned behaviorFlags)
492 { 493 {
494 m_hideTimerBehaviorFlags |= behaviorFlags;
fs 2015/02/06 15:20:59 This ought to be a simple assignment.
william.xie1 2015/02/06 15:45:10 You know, startHideMediaControlsTimer is also call
fs 2015/02/06 16:01:59 Ah ok. But that means that the stored flags need t
493 m_hideMediaControlsTimer.startOneShot(timeWithoutMouseMovementBeforeHidingMe diaControls, FROM_HERE); 495 m_hideMediaControlsTimer.startOneShot(timeWithoutMouseMovementBeforeHidingMe diaControls, FROM_HERE);
494 } 496 }
495 497
496 void MediaControls::stopHideMediaControlsTimer() 498 void MediaControls::stopHideMediaControlsTimer()
497 { 499 {
498 m_hideMediaControlsTimer.stop(); 500 m_hideMediaControlsTimer.stop();
501 m_hideTimerBehaviorFlags = IgnoreNone;
499 } 502 }
500 503
501 void MediaControls::resetHideMediaControlsTimer() 504 void MediaControls::resetHideMediaControlsTimer()
502 { 505 {
503 stopHideMediaControlsTimer(); 506 stopHideMediaControlsTimer();
504 if (!mediaElement().paused()) 507 if (!mediaElement().paused())
505 startHideMediaControlsTimer(); 508 startHideMediaControlsTimer();
506 } 509 }
507 510
508 511
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 visitor->trace(m_toggleClosedCaptionsButton); 568 visitor->trace(m_toggleClosedCaptionsButton);
566 visitor->trace(m_fullScreenButton); 569 visitor->trace(m_fullScreenButton);
567 visitor->trace(m_durationDisplay); 570 visitor->trace(m_durationDisplay);
568 visitor->trace(m_enclosure); 571 visitor->trace(m_enclosure);
569 visitor->trace(m_castButton); 572 visitor->trace(m_castButton);
570 visitor->trace(m_overlayCastButton); 573 visitor->trace(m_overlayCastButton);
571 HTMLDivElement::trace(visitor); 574 HTMLDivElement::trace(visitor);
572 } 575 }
573 576
574 } 577 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698