Title: [173562] branches/safari-600.1-branch/Source/WebCore
Revision
173562
Author
[email protected]
Date
2014-09-12 10:11:23 -0700 (Fri, 12 Sep 2014)

Log Message

Merged r173533.  rdar://problem/18187939

Modified Paths

Diff

Modified: branches/safari-600.1-branch/Source/WebCore/ChangeLog (173561 => 173562)


--- branches/safari-600.1-branch/Source/WebCore/ChangeLog	2014-09-12 16:27:47 UTC (rev 173561)
+++ branches/safari-600.1-branch/Source/WebCore/ChangeLog	2014-09-12 17:11:23 UTC (rev 173562)
@@ -1,3 +1,30 @@
+2014-09-12  Lucas Forschler  <[email protected]>
+
+        Merge r173533
+
+    2014-09-11  Jer Noble  <[email protected]>
+
+            Add site-specific quirk for entering fullscreen on YouTube.com.
+            https://bugs.webkit.org/show_bug.cgi?id=136742
+
+            Reviewed by Eric Carlson.
+
+            YouTube only resizes its <video> content when entering fullscreen after receiving the "webkitfullscreenchange"
+            event, which is fired once the animation to enter fullscreen completes. This leaves the apparent <video> content
+            too small during the animation, especially at the beginning of the animation. Add a site-specific hack for
+            YouTube sites which fires the "webkitfullscreenchange" event synchronously with the beginning of the enter
+            fullscreen animation. This will cause YouTube to resize their <video> content during the period of time where we
+            disable screen updates, and makes the enter fullscreen animation seamless.
+
+            Add a static utility method, hostIsYouTube(), for the various pieces of this site-specific hack, and expand it
+            to match youtube.co.uk, youtube.fr, etc.
+
+            * dom/Document.cpp:
+            (WebCore::hostIsYouTube): Added.
+            (WebCore::Document::webkitWillEnterFullScreenForElement): Fire fullscreenchange event if hacks are enabled.
+            (WebCore::Document::webkitDidEnterFullScreenForElement): Don't fire the event if same.
+            (WebCore::Document::webkitDidExitFullScreenForElement): Use hostIsYouTube().
+
 2014-09-08  Lucas Forschler  <[email protected]>
 
         Merge r173365

Modified: branches/safari-600.1-branch/Source/WebCore/dom/Document.cpp (173561 => 173562)


--- branches/safari-600.1-branch/Source/WebCore/dom/Document.cpp	2014-09-12 16:27:47 UTC (rev 173561)
+++ branches/safari-600.1-branch/Source/WebCore/dom/Document.cpp	2014-09-12 17:11:23 UTC (rev 173562)
@@ -158,6 +158,7 @@
 #include <wtf/CurrentTime.h>
 #include <wtf/TemporaryChange.h>
 #include <wtf/text/StringBuffer.h>
+#include <yarr/RegularExpression.h>
 
 #if ENABLE(SHARED_WORKERS)
 #include "SharedWorkerRepository.h"
@@ -5331,6 +5332,15 @@
         fullScreenElement->parentNode()->setNeedsStyleRecalc(ReconstructRenderTree);
 }
 
+static bool hostIsYouTube(const String& host)
+{
+    // Match .youtube.com, youtube.com, youtube.co.uk, and all two-letter country codes.
+    static NeverDestroyed<JSC::Yarr::RegularExpression> youtubePattern("(^|\\.)youtube.(com|co.uk|[a-z]{2})$", TextCaseInsensitive);
+    ASSERT(youtubePattern.get().isValid());
+
+    return youtubePattern.get().match(host);
+}
+
 void Document::webkitWillEnterFullScreenForElement(Element* element)
 {
     if (!hasLivingRenderTree() || inPageCache())
@@ -5368,7 +5378,10 @@
         RenderFullScreen::wrapRenderer(renderer, renderer ? renderer->parent() : nullptr, *this);
 
     m_fullScreenElement->setContainsFullScreenElementOnAncestorsCrossingFrameBoundaries(true);
-    
+
+    if (settings() && settings()->needsSiteSpecificQuirks() && hostIsYouTube(url().host()))
+        fullScreenChangeDelayTimerFired(m_fullScreenChangeDelayTimer);
+
     recalcStyle(Style::Force);
 }
 
@@ -5382,7 +5395,8 @@
 
     m_fullScreenElement->didBecomeFullscreenElement();
 
-    m_fullScreenChangeDelayTimer.startOneShot(0);
+    if (!settings() || !settings()->needsSiteSpecificQuirks() || !hostIsYouTube(url().host()))
+        m_fullScreenChangeDelayTimer.startOneShot(0);
 }
 
 void Document::webkitWillExitFullScreenForElement(Element*)
@@ -5421,8 +5435,7 @@
 
     // FIXME(136605): Remove this quirk once YouTube moves to relative widths and heights for
     // fullscreen mode.
-    String host = url().host();
-    if (settings() && settings()->needsSiteSpecificQuirks() && (host.endsWith(".youtube.com", false) || equalIgnoringCase("youtube.com", host)))
+    if (settings() && settings()->needsSiteSpecificQuirks() && hostIsYouTube(url().host()))
         exitingDocument.fullScreenChangeDelayTimerFired(exitingDocument.m_fullScreenChangeDelayTimer);
     else
         exitingDocument.m_fullScreenChangeDelayTimer.startOneShot(0);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to