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

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

Issue 2643723003: 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
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 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 } 563 }
564 564
565 void MediaControls::stoppedCasting() { 565 void MediaControls::stoppedCasting() {
566 m_castButton->setIsPlayingRemotely(false); 566 m_castButton->setIsPlayingRemotely(false);
567 m_overlayCastButton->setIsPlayingRemotely(false); 567 m_overlayCastButton->setIsPlayingRemotely(false);
568 } 568 }
569 569
570 void MediaControls::defaultEventHandler(Event* event) { 570 void MediaControls::defaultEventHandler(Event* event) {
571 HTMLDivElement::defaultEventHandler(event); 571 HTMLDivElement::defaultEventHandler(event);
572 572
573 // Do not handle events to not interfere with the rest of the page if no
574 // controls should be visible.
575 if (!mediaElement().shouldShowControls())
576 return;
577
573 // Add IgnoreControlsHover to m_hideTimerBehaviorFlags when we see a touch 578 // Add IgnoreControlsHover to m_hideTimerBehaviorFlags when we see a touch
574 // event, to allow the hide-timer to do the right thing when it fires. 579 // event, to allow the hide-timer to do the right thing when it fires.
575 // FIXME: Preferably we would only do this when we're actually handling the 580 // FIXME: Preferably we would only do this when we're actually handling the
576 // event here ourselves. 581 // event here ourselves.
577 bool isTouchEvent = 582 bool isTouchEvent =
578 event->isTouchEvent() || event->isGestureEvent() || 583 event->isTouchEvent() || event->isGestureEvent() ||
579 (event->isMouseEvent() && toMouseEvent(event)->fromTouch()); 584 (event->isMouseEvent() && toMouseEvent(event)->fromTouch());
580 m_hideTimerBehaviorFlags |= isTouchEvent ? IgnoreControlsHover : IgnoreNone; 585 m_hideTimerBehaviorFlags |= isTouchEvent ? IgnoreControlsHover : IgnoreNone;
581 586
582 // Touch events are treated differently to avoid fake mouse events to trigger 587 // Touch events are treated differently to avoid fake mouse events to trigger
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
967 visitor->trace(m_overflowList); 972 visitor->trace(m_overflowList);
968 visitor->trace(m_castButton); 973 visitor->trace(m_castButton);
969 visitor->trace(m_overlayCastButton); 974 visitor->trace(m_overlayCastButton);
970 visitor->trace(m_mediaEventListener); 975 visitor->trace(m_mediaEventListener);
971 visitor->trace(m_windowEventListener); 976 visitor->trace(m_windowEventListener);
972 visitor->trace(m_orientationLockDelegate); 977 visitor->trace(m_orientationLockDelegate);
973 HTMLDivElement::trace(visitor); 978 HTMLDivElement::trace(visitor);
974 } 979 }
975 980
976 } // namespace blink 981 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698