Chromium Code Reviews| 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 m_castButton->setIsPlayingRemotely(true); | 428 m_castButton->setIsPlayingRemotely(true); |
| 429 m_overlayCastButton->setIsPlayingRemotely(true); | 429 m_overlayCastButton->setIsPlayingRemotely(true); |
| 430 } | 430 } |
| 431 | 431 |
| 432 void MediaControls::stoppedCasting() | 432 void MediaControls::stoppedCasting() |
| 433 { | 433 { |
| 434 m_castButton->setIsPlayingRemotely(false); | 434 m_castButton->setIsPlayingRemotely(false); |
| 435 m_overlayCastButton->setIsPlayingRemotely(false); | 435 m_overlayCastButton->setIsPlayingRemotely(false); |
| 436 } | 436 } |
| 437 | 437 |
| 438 bool MediaControls::isInactiveElement(Node* node) const | |
| 439 { | |
| 440 if (node == m_mediaElement | |
| 441 || node == m_textDisplayContainer | |
| 442 || node == m_overlayEnclosure | |
| 443 || node == m_enclosure) | |
| 444 return true; | |
| 445 | |
| 446 return false; | |
| 447 } | |
| 448 | |
| 438 void MediaControls::defaultEventHandler(Event* event) | 449 void MediaControls::defaultEventHandler(Event* event) |
| 439 { | 450 { |
| 440 HTMLDivElement::defaultEventHandler(event); | 451 HTMLDivElement::defaultEventHandler(event); |
| 441 m_wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent() | 452 m_wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent() |
| 442 || (event->isMouseEvent() && toMouseEvent(event)->fromTouch()); | 453 || (event->isMouseEvent() && toMouseEvent(event)->fromTouch()); |
| 443 | 454 |
| 455 // Separate tap gestures from mouse clicks unless the tap | |
| 456 // is intended for an input element like a button. | |
| 457 if (event->type() == EventTypeNames::gesturetap) { | |
| 458 Node * targetNode = event->target() ? event->target()->toNode() : nullpt r; | |
| 459 if (!targetNode || isInactiveElement(targetNode)) { | |
| 460 // Do not generate mouse events from this tap | |
|
philipj_slow
2015/02/11 06:57:38
Is this necessary? How about simply listening to c
| |
| 461 event->preventDefault(); | |
|
qinmin
2015/02/11 22:29:12
What if there is a onclick eventhandler on the Med
Tima Vaisburd
2015/02/11 22:48:20
In this case the solution won't work.
We can't sim
philipj_slow
2015/02/12 02:31:20
What causes the pause? Maybe you were testing whil
| |
| 462 | |
| 463 if (!m_panel->isOpaque()) { | |
| 464 makeOpaque(); | |
| 465 startHideMediaControlsTimer(); | |
| 466 // Prevent immediate hiding by playbackProgressed() | |
|
philipj_slow
2015/02/11 06:57:38
This seems like a bit of a hack, I think it would
Tima Vaisburd
2015/02/12 03:18:02
Yes, I agree, but so far I haven;t come up with a
| |
| 467 m_isMouseOverControls = true; | |
| 468 } else { | |
| 469 stopHideMediaControlsTimer(); | |
| 470 makeTransparent(); | |
| 471 } | |
| 472 } | |
| 473 return; | |
| 474 } | |
| 475 | |
| 444 if (event->type() == EventTypeNames::mouseover) { | 476 if (event->type() == EventTypeNames::mouseover) { |
| 445 if (!containsRelatedTarget(event)) { | 477 if (!containsRelatedTarget(event)) { |
| 446 m_isMouseOverControls = true; | 478 m_isMouseOverControls = true; |
| 447 if (!mediaElement().togglePlayStateWillPlay()) { | 479 if (!mediaElement().togglePlayStateWillPlay()) { |
| 448 makeOpaque(); | 480 makeOpaque(); |
| 449 if (shouldHideMediaControls()) | 481 if (shouldHideMediaControls()) |
| 450 startHideMediaControlsTimer(); | 482 startHideMediaControlsTimer(); |
| 451 } | 483 } |
| 452 } | 484 } |
| 453 return; | 485 return; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 565 visitor->trace(m_toggleClosedCaptionsButton); | 597 visitor->trace(m_toggleClosedCaptionsButton); |
| 566 visitor->trace(m_fullScreenButton); | 598 visitor->trace(m_fullScreenButton); |
| 567 visitor->trace(m_durationDisplay); | 599 visitor->trace(m_durationDisplay); |
| 568 visitor->trace(m_enclosure); | 600 visitor->trace(m_enclosure); |
| 569 visitor->trace(m_castButton); | 601 visitor->trace(m_castButton); |
| 570 visitor->trace(m_overlayCastButton); | 602 visitor->trace(m_overlayCastButton); |
| 571 HTMLDivElement::trace(visitor); | 603 HTMLDivElement::trace(visitor); |
| 572 } | 604 } |
| 573 | 605 |
| 574 } | 606 } |
| OLD | NEW |