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

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

Issue 917043003: Make MediaControls::m_wasLastEventTouch a local variable (Closed) Base URL: svn://svn.chromium.org/blink/trunk
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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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 }
OLDNEW
« no previous file with comments | « Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698