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_hideTimerBehaviorFlags(IgnoreNone) | 68 , m_hideTimerBehaviorFlags(IgnoreNone) |
69 , m_isMouseOverControls(false) | 69 , m_isMouseOverControls(false) |
70 , m_isPausedForScrubbing(false) | 70 , m_isPausedForScrubbing(false) |
71 , m_wasLastEventTouch(false) | |
72 { | 71 { |
73 } | 72 } |
74 | 73 |
75 PassRefPtrWillBeRawPtr<MediaControls> MediaControls::create(HTMLMediaElement& me
diaElement) | 74 PassRefPtrWillBeRawPtr<MediaControls> MediaControls::create(HTMLMediaElement& me
diaElement) |
76 { | 75 { |
77 RefPtrWillBeRawPtr<MediaControls> controls = adoptRefWillBeNoop(new MediaCon
trols(mediaElement)); | 76 RefPtrWillBeRawPtr<MediaControls> controls = adoptRefWillBeNoop(new MediaCon
trols(mediaElement)); |
78 controls->setShadowPseudoId(AtomicString("-webkit-media-controls", AtomicStr
ing::ConstructFromLiteral)); | 77 controls->setShadowPseudoId(AtomicString("-webkit-media-controls", AtomicStr
ing::ConstructFromLiteral)); |
79 controls->initializeControls(); | 78 controls->initializeControls(); |
80 return controls.release(); | 79 return controls.release(); |
81 } | 80 } |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 | 431 |
433 void MediaControls::stoppedCasting() | 432 void MediaControls::stoppedCasting() |
434 { | 433 { |
435 m_castButton->setIsPlayingRemotely(false); | 434 m_castButton->setIsPlayingRemotely(false); |
436 m_overlayCastButton->setIsPlayingRemotely(false); | 435 m_overlayCastButton->setIsPlayingRemotely(false); |
437 } | 436 } |
438 | 437 |
439 void MediaControls::defaultEventHandler(Event* event) | 438 void MediaControls::defaultEventHandler(Event* event) |
440 { | 439 { |
441 HTMLDivElement::defaultEventHandler(event); | 440 HTMLDivElement::defaultEventHandler(event); |
442 m_wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent() | |
443 || (event->isMouseEvent() && toMouseEvent(event)->fromTouch()); | |
444 | 441 |
445 // Add IgnoreControlsHover to m_hideTimerBehaviorFlags when we see a touch e
vent, | 442 // Add IgnoreControlsHover to m_hideTimerBehaviorFlags when we see a touch e
vent, |
446 // to allow the hide-timer to do the right thing when it fires. | 443 // to allow the hide-timer to do the right thing when it fires. |
447 // FIXME: Preferably we would only do this when we're actually handling the
event | 444 // FIXME: Preferably we would only do this when we're actually handling the
event |
448 // here ourselves. | 445 // here ourselves. |
449 m_hideTimerBehaviorFlags |= m_wasLastEventTouch ? IgnoreControlsHover : Igno
reNone; | 446 bool wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent() |
| 447 || (event->isMouseEvent() && toMouseEvent(event)->fromTouch()); |
| 448 m_hideTimerBehaviorFlags |= wasLastEventTouch ? IgnoreControlsHover : Ignore
None; |
450 | 449 |
451 if (event->type() == EventTypeNames::mouseover) { | 450 if (event->type() == EventTypeNames::mouseover) { |
452 if (!containsRelatedTarget(event)) { | 451 if (!containsRelatedTarget(event)) { |
453 m_isMouseOverControls = true; | 452 m_isMouseOverControls = true; |
454 if (!mediaElement().togglePlayStateWillPlay()) { | 453 if (!mediaElement().togglePlayStateWillPlay()) { |
455 makeOpaque(); | 454 makeOpaque(); |
456 if (shouldHideMediaControls()) | 455 if (shouldHideMediaControls()) |
457 startHideMediaControlsTimer(); | 456 startHideMediaControlsTimer(); |
458 } | 457 } |
459 } | 458 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 visitor->trace(m_toggleClosedCaptionsButton); | 570 visitor->trace(m_toggleClosedCaptionsButton); |
572 visitor->trace(m_fullScreenButton); | 571 visitor->trace(m_fullScreenButton); |
573 visitor->trace(m_durationDisplay); | 572 visitor->trace(m_durationDisplay); |
574 visitor->trace(m_enclosure); | 573 visitor->trace(m_enclosure); |
575 visitor->trace(m_castButton); | 574 visitor->trace(m_castButton); |
576 visitor->trace(m_overlayCastButton); | 575 visitor->trace(m_overlayCastButton); |
577 HTMLDivElement::trace(visitor); | 576 HTMLDivElement::trace(visitor); |
578 } | 577 } |
579 | 578 |
580 } | 579 } |
OLD | NEW |