Guest User

Untitled

a guest
Jun 25th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.78 KB | None | 0 0
  1. diff --git c/WebCore/html/HTMLMediaElement.cpp i/WebCore/html/HTMLMediaElement.cpp
  2. index e9dc263..1b0f192 100644
  3. --- c/WebCore/html/HTMLMediaElement.cpp
  4. +++ i/WebCore/html/HTMLMediaElement.cpp
  5. @@ -1943,6 +1943,9 @@ void HTMLMediaElement::updatePlayState()
  6. setDisplayMode(Video);
  7.  
  8. if (playerPaused) {
  9. + if (m_player->shouldForceFullscreenVideoPlayback() && !m_isFullscreen)
  10. + enterFullscreen();
  11. +
  12. // Set rate before calling play in case the rate was set before the media engine was setup.
  13. // The media engine should just stash the rate since it isn't already playing.
  14. m_player->setRate(m_playbackRate);
  15. @@ -2259,6 +2262,9 @@ void HTMLMediaElement::exitFullscreen()
  16. ASSERT(m_isFullscreen);
  17. m_isFullscreen = false;
  18. if (document() && document()->page()) {
  19. + if (m_player->shouldForceFullscreenVideoPlayback())
  20. + pauseInternal();
  21. +
  22. document()->page()->chrome()->client()->exitFullscreenForNode(this);
  23. scheduleEvent(eventNames().webkitendfullscreenEvent);
  24. if (renderer())
  25. diff --git c/WebCore/page/ChromeClient.h i/WebCore/page/ChromeClient.h
  26. index 7542615..66313d2 100644
  27. --- c/WebCore/page/ChromeClient.h
  28. +++ i/WebCore/page/ChromeClient.h
  29. @@ -244,6 +244,10 @@ namespace WebCore {
  30. virtual void enterFullScreenForElement(Element*) { }
  31. virtual void exitFullScreenForElement(Element*) { }
  32. #endif
  33. +
  34. +#if ENABLE(VIDEO)
  35. + virtual bool shouldForceFullScreenVideoPlayback() { return false; }
  36. +#endif
  37.  
  38. #if ENABLE(TILED_BACKING_STORE)
  39. virtual IntRect visibleRectForTiledBackingStore() const { return IntRect(); }
  40. diff --git c/WebCore/platform/graphics/MediaPlayer.cpp i/WebCore/platform/graphics/MediaPlayer.cpp
  41. index 2a9e64e..6c2cdb7 100644
  42. --- c/WebCore/platform/graphics/MediaPlayer.cpp
  43. +++ i/WebCore/platform/graphics/MediaPlayer.cpp
  44. @@ -28,6 +28,8 @@
  45. #if ENABLE(VIDEO)
  46. #include "MediaPlayer.h"
  47.  
  48. +#include "Chrome.h"
  49. +#include "ChromeClient.h"
  50. #include "ContentType.h"
  51. #include "Document.h"
  52. #include "Frame.h"
  53. @@ -397,6 +399,18 @@ bool MediaPlayer::supportsFullscreen() const
  54. return m_private->supportsFullscreen();
  55. }
  56.  
  57. +bool MediaPlayer::shouldForceFullscreenVideoPlayback() const
  58. +{
  59. + Document* doc = document();
  60. + if (!doc || !doc->page())
  61. + return false;
  62. +
  63. + if (doc->page()->chrome()->client()->shouldForceFullScreenVideoPlayback())
  64. + return true;
  65. +
  66. + return false;
  67. +}
  68. +
  69. bool MediaPlayer::supportsSave() const
  70. {
  71. return m_private->supportsSave();
  72. @@ -417,12 +431,16 @@ bool MediaPlayer::hasAudio() const
  73. return m_private->hasAudio();
  74. }
  75.  
  76. -bool MediaPlayer::inMediaDocument()
  77. +Document* MediaPlayer::document() const
  78. {
  79. Frame* frame = m_frameView ? m_frameView->frame() : 0;
  80. - Document* document = frame ? frame->document() : 0;
  81. -
  82. - return document && document->isMediaDocument();
  83. + return frame ? frame->document() : 0;
  84. +}
  85. +
  86. +bool MediaPlayer::inMediaDocument()
  87. +{
  88. + Document* doc = document();
  89. + return doc && doc->isMediaDocument();
  90. }
  91.  
  92. PlatformMedia MediaPlayer::platformMedia() const
  93. diff --git c/WebCore/platform/graphics/MediaPlayer.h i/WebCore/platform/graphics/MediaPlayer.h
  94. index c2d0a00..48eca4e 100644
  95. --- c/WebCore/platform/graphics/MediaPlayer.h
  96. +++ i/WebCore/platform/graphics/MediaPlayer.h
  97. @@ -162,6 +162,7 @@ public:
  98. static bool isAvailable();
  99.  
  100. bool supportsFullscreen() const;
  101. + bool shouldForceFullscreenVideoPlayback() const;
  102. bool supportsSave() const;
  103. PlatformMedia platformMedia() const;
  104. #if USE(ACCELERATED_COMPOSITING)
  105. @@ -279,6 +280,8 @@ private:
  106.  
  107. static void initializeMediaEngines();
  108.  
  109. + Document* document() const;
  110. +
  111. MediaPlayerClient* m_mediaPlayerClient;
  112. OwnPtr<MediaPlayerPrivateInterface*> m_private;
  113. void* m_currentMediaEngine;
Add Comment
Please, Sign In to add comment