Changeset 87661 in webkit
- Timestamp:
- May 29, 2011 8:37:14 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r87660 r87661 1 2011-05-29 Brian Weinstein <bweinstein@apple.com> 2 3 Reviewed by Darin Adler. 4 5 Controls never hide in full screen after user stops moving mouse 6 https://bugs.webkit.org/show_bug.cgi?id=61715 7 <rdar://problem/9522182> 8 9 When we get a mouse move event in HTMLMediaElement::defaultEventHandler, and we are in full screen, 10 show the media controls, and then start a timer. 11 12 The timer fires 3 seconds after the user's last mouse movement (timer is restarted on every mouse 13 move), and hides the controls. 14 15 * html/HTMLMediaElement.cpp: 16 (WebCore::HTMLMediaElement::HTMLMediaElement): Initialize our new timer. 17 (WebCore::HTMLMediaElement::play): If we are in full screen mode, start our timer to hide the full screen 18 controls. We don't want the user to have to move the mouse to hide them when they use the spacebar 19 to play. 20 (WebCore::HTMLMediaElement::startHideFullscreenControlsTimer): Starts a oneshot timer 3 seconds in the future 21 if we are in full screen. 22 (WebCore::HTMLMediaElement::hideFullscreenControlsTimerFired): Make sure that we are currently playing, and 23 we are in full screen, and hide the controls. We don't want to hide the controls if we are paused. 24 (WebCore::HTMLMediaElement::stopHideFullscreenControlsTimer): Stops the timer. 25 (WebCore::HTMLMediaElement::defaultEventHandler): If we get a mouse move event and are in full screen, show the 26 controls and start a timer to hide them. 27 (WebCore::HTMLMediaElement::enterFullscreen): Start a timer to hide the full screen controls. The user shouldn't 28 have the move the mouse once they enter full screen to hide the controls. 29 (WebCore::HTMLMediaElement::exitFullscreen): Stop the timer to hide the full screen controls. 30 * html/HTMLMediaElement.h: 31 * html/shadow/MediaControls.h: Added pure virtual shouldHideControls() method. 32 * html/shadow/MediaControlRootElement.cpp: 33 (WebCore::MediaControlRootElement::playbackStopped): Stop the timer to hide the full screen controls. 34 (WebCore::MediaControlRootElement::shouldHideControls): Added, only report that 35 the caller should hide the controls if the panel is not hovered. 36 * html/shadow/MediaControlRootElement.h: 37 1 38 2011-05-29 Jer Noble <jer.noble@apple.com> 2 39 -
trunk/Source/WebCore/html/HTMLMediaElement.cpp
r87657 r87661 124 124 , m_progressEventTimer(this, &HTMLMediaElement::progressEventTimerFired) 125 125 , m_playbackProgressTimer(this, &HTMLMediaElement::playbackProgressTimerFired) 126 , m_hideFullscreenControlsTimer(this, &HTMLMediaElement::hideFullscreenControlsTimerFired) 126 127 , m_playedTimeRanges() 127 128 , m_playbackRate(1.0f) … … 1426 1427 } 1427 1428 1429 if (isFullscreen()) 1430 startHideFullscreenControlsTimer(); 1431 1428 1432 playInternal(); 1429 1433 } … … 1611 1615 static const double maxTimeupdateEventFrequency = 0.25; 1612 1616 1617 static const double timeWithoutMouseMovementBeforeHidingControls = 3; 1618 1613 1619 void HTMLMediaElement::startPlaybackProgressTimer() 1614 1620 { … … 1634 1640 } 1635 1641 // FIXME: deal with cue ranges here 1642 } 1643 1644 void HTMLMediaElement::startHideFullscreenControlsTimer() 1645 { 1646 if (!isFullscreen()) 1647 return; 1648 1649 m_hideFullscreenControlsTimer.startOneShot(timeWithoutMouseMovementBeforeHidingControls); 1650 } 1651 1652 void HTMLMediaElement::hideFullscreenControlsTimerFired(Timer<HTMLMediaElement>*) 1653 { 1654 if (!m_playing) 1655 return; 1656 1657 if (!isFullscreen()) 1658 return; 1659 1660 if (!controls() || !hasMediaControls()) 1661 return; 1662 1663 if (!mediaControls()->shouldHideControls()) 1664 return; 1665 1666 mediaControls()->makeTransparent(); 1667 } 1668 1669 void HTMLMediaElement::stopHideFullscreenControlsTimer() 1670 { 1671 m_hideFullscreenControlsTimer.stop(); 1636 1672 } 1637 1673 … … 2379 2415 if (event->type() == eventNames().mouseoverEvent) { 2380 2416 m_mouseOver = true; 2381 if (hasMediaControls() && controls() && !canPlay()) 2417 if (hasMediaControls() && controls() && !canPlay()) { 2382 2418 mediaControls()->makeOpaque(); 2383 } else if (event->type() == eventNames().mouseoutEvent) 2419 if (mediaControls()->shouldHideControls()) 2420 startHideFullscreenControlsTimer(); 2421 } 2422 } else if (event->type() == eventNames().mouseoutEvent) { 2384 2423 m_mouseOver = false; 2424 stopHideFullscreenControlsTimer(); 2425 } else if (event->type() == eventNames().mousemoveEvent) { 2426 if (isFullscreen() && hasMediaControls() && controls()) { 2427 // When we get a mouse move in fullscreen mode, show the media controls, and start a timer 2428 // that will hide the media controls after a 3 seconds without a mouse move. 2429 mediaControls()->makeOpaque(); 2430 if (mediaControls()->shouldHideControls()) 2431 startHideFullscreenControlsTimer(); 2432 } 2433 } 2434 2385 2435 } 2386 2436 } … … 2519 2569 { 2520 2570 LOG(Media, "HTMLMediaElement::enterFullscreen"); 2571 2572 startHideFullscreenControlsTimer(); 2573 2521 2574 #if ENABLE(FULLSCREEN_API) 2522 2575 if (document() && document()->settings() && document()->settings()->fullScreenEnabled()) { … … 2538 2591 { 2539 2592 LOG(Media, "HTMLMediaElement::exitFullscreen"); 2593 2594 stopHideFullscreenControlsTimer(); 2595 2540 2596 #if ENABLE(FULLSCREEN_API) 2541 2597 if (document() && document()->settings() && document()->settings()->fullScreenEnabled()) { -
trunk/Source/WebCore/html/HTMLMediaElement.h
r87657 r87661 147 147 void beginScrubbing(); 148 148 void endScrubbing(); 149 150 void stopHideFullscreenControlsTimer(); 149 151 150 152 bool canPlay() const; … … 271 273 void progressEventTimerFired(Timer<HTMLMediaElement>*); 272 274 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); 275 void hideFullscreenControlsTimerFired(Timer<HTMLMediaElement>*); 273 276 void startPlaybackProgressTimer(); 274 277 void startProgressEventTimer(); 278 void startHideFullscreenControlsTimer(); 275 279 void stopPeriodicTimers(); 276 280 … … 342 346 Timer<HTMLMediaElement> m_progressEventTimer; 343 347 Timer<HTMLMediaElement> m_playbackProgressTimer; 348 Timer<HTMLMediaElement> m_hideFullscreenControlsTimer; 344 349 Vector<RefPtr<Event> > m_pendingEvents; 345 350 RefPtr<TimeRanges> m_playedTimeRanges; -
trunk/Source/WebCore/html/shadow/MediaControlRootElement.cpp
r87557 r87661 351 351 updateTimeDisplay(); 352 352 makeOpaque(); 353 354 m_mediaElement->stopHideFullscreenControlsTimer(); 353 355 } 354 356 … … 458 460 } 459 461 462 bool MediaControlRootElement::shouldHideControls() 463 { 464 return !m_panel->hovered(); 465 } 466 460 467 const AtomicString& MediaControlRootElement::shadowPseudoId() const 461 468 { -
trunk/Source/WebCore/html/shadow/MediaControlRootElement.h
r85949 r87661 97 97 void updateStatusDisplay(); 98 98 99 virtual bool shouldHideControls(); 99 100 private: 100 101 MediaControlRootElement(HTMLMediaElement*); -
trunk/Source/WebCore/html/shadow/MediaControls.h
r85949 r87661 69 69 virtual void updateStatusDisplay() = 0; 70 70 71 virtual bool shouldHideControls() = 0; 72 71 73 protected: 72 74 MediaControls(HTMLMediaElement*);
Note: See TracChangeset
for help on using the changeset viewer.