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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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_isMouseOverControls(false) | 68 , m_isMouseOverControls(false) |
69 , m_isPausedForScrubbing(false) | 69 , m_isPausedForScrubbing(false) |
70 , m_wasLastEventTouch(false) | 70 , m_wasLastEventTouch(false) |
71 , m_HideTimerBehaviorFlags(IgnoreNone) | |
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)); |
78 controls->initializeControls(); | 79 controls->initializeControls(); |
79 return controls.release(); | 80 return controls.release(); |
80 } | 81 } |
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
470 startHideMediaControlsTimer(); | 471 startHideMediaControlsTimer(); |
471 return; | 472 return; |
472 } | 473 } |
473 } | 474 } |
474 | 475 |
475 void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*) | 476 void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*) |
476 { | 477 { |
477 if (mediaElement().togglePlayStateWillPlay()) | 478 if (mediaElement().togglePlayStateWillPlay()) |
478 return; | 479 return; |
479 | 480 |
480 unsigned behaviorFlags = IgnoreFocus | IgnoreVideoHover; | 481 m_HideTimerBehaviorFlags |= IgnoreFocus; |
481 if (m_wasLastEventTouch) { | 482 m_HideTimerBehaviorFlags |= IgnoreVideoHover; |
fs
2015/02/06 13:43:32
I'd make this similar to the previous PS:
unsigne
william.xie1
2015/02/06 14:59:20
Done.
| |
482 behaviorFlags |= IgnoreControlsHover; | 483 if (!shouldHideMediaControls(m_HideTimerBehaviorFlags)) |
483 } | |
484 if (!shouldHideMediaControls(behaviorFlags)) | |
485 return; | 484 return; |
486 | 485 |
487 makeTransparent(); | 486 makeTransparent(); |
488 m_overlayCastButton->hide(); | 487 m_overlayCastButton->hide(); |
489 } | 488 } |
490 | 489 |
491 void MediaControls::startHideMediaControlsTimer() | 490 void MediaControls::startHideMediaControlsTimer() |
492 { | 491 { |
492 if (m_wasLastEventTouch) { | |
fs
2015/02/06 13:43:32
Get rid of m_wasLastEventTouch, and either pass th
| |
493 m_HideTimerBehaviorFlags = IgnoreControlsHover; | |
494 } | |
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 Loading... | |
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 } |
OLD | NEW |