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

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

Issue 2648263004: Media Controls: do not handle any event if no controls should be visible. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/LayoutTests/media/video-no-controls-events-not-absorbed.html ('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 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 } 583 }
584 584
585 void MediaControls::stoppedCasting() { 585 void MediaControls::stoppedCasting() {
586 m_castButton->setIsPlayingRemotely(false); 586 m_castButton->setIsPlayingRemotely(false);
587 m_overlayCastButton->setIsPlayingRemotely(false); 587 m_overlayCastButton->setIsPlayingRemotely(false);
588 } 588 }
589 589
590 void MediaControls::defaultEventHandler(Event* event) { 590 void MediaControls::defaultEventHandler(Event* event) {
591 HTMLDivElement::defaultEventHandler(event); 591 HTMLDivElement::defaultEventHandler(event);
592 592
593 // Do not handle events to not interfere with the rest of the page if no
594 // controls should be visible.
595 if (!mediaElement().shouldShowControls())
596 return;
597
593 // Add IgnoreControlsHover to m_hideTimerBehaviorFlags when we see a touch 598 // Add IgnoreControlsHover to m_hideTimerBehaviorFlags when we see a touch
594 // event, to allow the hide-timer to do the right thing when it fires. 599 // event, to allow the hide-timer to do the right thing when it fires.
595 // FIXME: Preferably we would only do this when we're actually handling the 600 // FIXME: Preferably we would only do this when we're actually handling the
596 // event here ourselves. 601 // event here ourselves.
597 bool isTouchEvent = 602 bool isTouchEvent =
598 event->isTouchEvent() || event->isGestureEvent() || 603 event->isTouchEvent() || event->isGestureEvent() ||
599 (event->isMouseEvent() && toMouseEvent(event)->fromTouch()); 604 (event->isMouseEvent() && toMouseEvent(event)->fromTouch());
600 m_hideTimerBehaviorFlags |= isTouchEvent ? IgnoreControlsHover : IgnoreNone; 605 m_hideTimerBehaviorFlags |= isTouchEvent ? IgnoreControlsHover : IgnoreNone;
601 606
602 // Touch events are treated differently to avoid fake mouse events to trigger 607 // Touch events are treated differently to avoid fake mouse events to trigger
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 visitor->trace(m_overflowMenu); 913 visitor->trace(m_overflowMenu);
909 visitor->trace(m_overflowList); 914 visitor->trace(m_overflowList);
910 visitor->trace(m_castButton); 915 visitor->trace(m_castButton);
911 visitor->trace(m_overlayCastButton); 916 visitor->trace(m_overlayCastButton);
912 visitor->trace(m_mediaEventListener); 917 visitor->trace(m_mediaEventListener);
913 visitor->trace(m_windowEventListener); 918 visitor->trace(m_windowEventListener);
914 HTMLDivElement::trace(visitor); 919 HTMLDivElement::trace(visitor);
915 } 920 }
916 921
917 } // namespace blink 922 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/media/video-no-controls-events-not-absorbed.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698