OLD | NEW |
---|---|
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 Loading... | |
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 , m_wasLastEventTouch(false) |
71 { | 72 { |
72 } | 73 } |
73 | 74 |
74 PassRefPtrWillBeRawPtr<MediaControls> MediaControls::create(HTMLMediaElement& me diaElement) | 75 PassRefPtrWillBeRawPtr<MediaControls> MediaControls::create(HTMLMediaElement& me diaElement) |
75 { | 76 { |
76 RefPtrWillBeRawPtr<MediaControls> controls = adoptRefWillBeNoop(new MediaCon trols(mediaElement)); | 77 RefPtrWillBeRawPtr<MediaControls> controls = adoptRefWillBeNoop(new MediaCon trols(mediaElement)); |
77 controls->setShadowPseudoId(AtomicString("-webkit-media-controls", AtomicStr ing::ConstructFromLiteral)); | 78 controls->setShadowPseudoId(AtomicString("-webkit-media-controls", AtomicStr ing::ConstructFromLiteral)); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
434 m_castButton->setIsPlayingRemotely(false); | 435 m_castButton->setIsPlayingRemotely(false); |
435 m_overlayCastButton->setIsPlayingRemotely(false); | 436 m_overlayCastButton->setIsPlayingRemotely(false); |
436 } | 437 } |
437 | 438 |
438 void MediaControls::defaultEventHandler(Event* event) | 439 void MediaControls::defaultEventHandler(Event* event) |
439 { | 440 { |
440 HTMLDivElement::defaultEventHandler(event); | 441 HTMLDivElement::defaultEventHandler(event); |
441 m_wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent() | 442 m_wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent() |
442 || (event->isMouseEvent() && toMouseEvent(event)->fromTouch()); | 443 || (event->isMouseEvent() && toMouseEvent(event)->fromTouch()); |
443 | 444 |
445 // We mark IgnoreControlsHover to m_hideTimerBehaviorFlags for last touch ev ent | |
fs
2015/02/06 17:04:37
Nit: Maybe reword this a bit:
Add IgnoreControlsH
william.xie1
2015/02/06 17:11:05
Done.
| |
446 // so that media control bar goes to hide | |
447 m_hideTimerBehaviorFlags |= m_wasLastEventTouch ? IgnoreControlsHover : Igno reNone; | |
448 | |
444 if (event->type() == EventTypeNames::mouseover) { | 449 if (event->type() == EventTypeNames::mouseover) { |
445 if (!containsRelatedTarget(event)) { | 450 if (!containsRelatedTarget(event)) { |
446 m_isMouseOverControls = true; | 451 m_isMouseOverControls = true; |
447 if (!mediaElement().togglePlayStateWillPlay()) { | 452 if (!mediaElement().togglePlayStateWillPlay()) { |
448 makeOpaque(); | 453 makeOpaque(); |
449 if (shouldHideMediaControls()) | 454 if (shouldHideMediaControls()) |
450 startHideMediaControlsTimer(); | 455 startHideMediaControlsTimer(); |
451 } | 456 } |
452 } | 457 } |
453 return; | 458 return; |
(...skipping 13 matching lines...) Expand all Loading... | |
467 makeOpaque(); | 472 makeOpaque(); |
468 refreshCastButtonVisibility(); | 473 refreshCastButtonVisibility(); |
469 if (shouldHideMediaControls(IgnoreVideoHover)) | 474 if (shouldHideMediaControls(IgnoreVideoHover)) |
470 startHideMediaControlsTimer(); | 475 startHideMediaControlsTimer(); |
471 return; | 476 return; |
472 } | 477 } |
473 } | 478 } |
474 | 479 |
475 void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*) | 480 void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*) |
476 { | 481 { |
482 unsigned behaviorFlags = m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVide oHover; | |
483 m_hideTimerBehaviorFlags = IgnoreNone; | |
484 | |
477 if (mediaElement().togglePlayStateWillPlay()) | 485 if (mediaElement().togglePlayStateWillPlay()) |
478 return; | 486 return; |
479 | 487 |
480 unsigned behaviorFlags = IgnoreFocus | IgnoreVideoHover; | |
481 if (m_wasLastEventTouch) { | |
482 behaviorFlags |= IgnoreControlsHover; | |
483 } | |
484 if (!shouldHideMediaControls(behaviorFlags)) | 488 if (!shouldHideMediaControls(behaviorFlags)) |
485 return; | 489 return; |
486 | 490 |
487 makeTransparent(); | 491 makeTransparent(); |
488 m_overlayCastButton->hide(); | 492 m_overlayCastButton->hide(); |
489 } | 493 } |
490 | 494 |
491 void MediaControls::startHideMediaControlsTimer() | 495 void MediaControls::startHideMediaControlsTimer() |
492 { | 496 { |
493 m_hideMediaControlsTimer.startOneShot(timeWithoutMouseMovementBeforeHidingMe diaControls, FROM_HERE); | 497 m_hideMediaControlsTimer.startOneShot(timeWithoutMouseMovementBeforeHidingMe diaControls, FROM_HERE); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
565 visitor->trace(m_toggleClosedCaptionsButton); | 569 visitor->trace(m_toggleClosedCaptionsButton); |
566 visitor->trace(m_fullScreenButton); | 570 visitor->trace(m_fullScreenButton); |
567 visitor->trace(m_durationDisplay); | 571 visitor->trace(m_durationDisplay); |
568 visitor->trace(m_enclosure); | 572 visitor->trace(m_enclosure); |
569 visitor->trace(m_castButton); | 573 visitor->trace(m_castButton); |
570 visitor->trace(m_overlayCastButton); | 574 visitor->trace(m_overlayCastButton); |
571 HTMLDivElement::trace(visitor); | 575 HTMLDivElement::trace(visitor); |
572 } | 576 } |
573 | 577 |
574 } | 578 } |
OLD | NEW |