Title: [200462] trunk/Source/WebCore
Revision
200462
Author
adac...@apple.com
Date
2016-05-05 11:14:48 -0700 (Thu, 05 May 2016)

Log Message

When exiting fullscreen, call a JS method immediately to implement the style changes for the presentation mode change right away
https://bugs.webkit.org/show_bug.cgi?id=157359

Reviewed by Eric Carlson.

No new tests as this is done to just mitigate a visual glitch.

* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::exitFullscreen):
(WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
* html/HTMLMediaElement.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (200461 => 200462)


--- trunk/Source/WebCore/ChangeLog	2016-05-05 17:43:04 UTC (rev 200461)
+++ trunk/Source/WebCore/ChangeLog	2016-05-05 18:14:48 UTC (rev 200462)
@@ -1,3 +1,17 @@
+2016-05-04  Ada Chan  <adac...@apple.com>
+
+        When exiting fullscreen, call a JS method immediately to implement the style changes for the presentation mode change right away
+        https://bugs.webkit.org/show_bug.cgi?id=157359
+
+        Reviewed by Eric Carlson.
+
+        No new tests as this is done to just mitigate a visual glitch.
+
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::exitFullscreen):
+        (WebCore::HTMLMediaElement::updateMediaControlsAfterPresentationModeChange):
+        * html/HTMLMediaElement.h:
+
 2016-05-04  Alex Christensen  <achristen...@webkit.org>
 
         Blocked redirected main resource requests need descriptive errors

Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (200461 => 200462)


--- trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-05-05 17:43:04 UTC (rev 200461)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp	2016-05-05 18:14:48 UTC (rev 200462)
@@ -5395,6 +5395,9 @@
     ASSERT(m_videoFullscreenMode != VideoFullscreenModeNone);
     VideoFullscreenMode oldVideoFullscreenMode = m_videoFullscreenMode;
     fullscreenModeChanged(VideoFullscreenModeNone);
+#if ENABLE(MEDIA_CONTROLS_SCRIPT)
+    updateMediaControlsAfterPresentationModeChange();
+#endif
     if (hasMediaControls())
         mediaControls()->exitedFullscreen();
     if (document().page() && is<HTMLVideoElement>(*this)) {
@@ -6540,6 +6543,35 @@
         document().unregisterForPageScaleFactorChangedCallbacks(this);
 }
 
+void HTMLMediaElement::updateMediaControlsAfterPresentationModeChange()
+{
+    DOMWrapperWorld& world = ensureIsolatedWorld();
+    ScriptController& scriptController = document().frame()->script();
+    JSDOMGlobalObject* globalObject = JSC::jsCast<JSDOMGlobalObject*>(scriptController.globalObject(world));
+    JSC::ExecState* exec = globalObject->globalExec();
+    JSC::JSLockHolder lock(exec);
+
+    JSC::JSValue controllerValue = controllerJSValue(*exec, *globalObject, *this);
+    JSC::JSObject* controllerObject = controllerValue.toObject(exec);
+
+    if (exec->hadException())
+        return;
+
+    JSC::JSValue functionValue = controllerObject->get(exec, JSC::Identifier::fromString(exec, "handlePresentationModeChange"));
+    if (exec->hadException() || functionValue.isUndefinedOrNull())
+        return;
+
+    JSC::JSObject* function = functionValue.toObject(exec);
+    ASSERT(!exec->hadException());
+    JSC::CallData callData;
+    JSC::CallType callType = function->methodTable()->getCallData(function, callData);
+    if (callType == JSC::CallType::None)
+        return;
+
+    JSC::MarkedArgumentBuffer argList;
+    JSC::call(exec, function, callType, callData, controllerObject, argList);
+}
+
 void HTMLMediaElement::pageScaleFactorChanged()
 {
     Page* page = document().page();

Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (200461 => 200462)


--- trunk/Source/WebCore/html/HTMLMediaElement.h	2016-05-05 17:43:04 UTC (rev 200461)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h	2016-05-05 18:14:48 UTC (rev 200462)
@@ -483,6 +483,7 @@
 #if ENABLE(MEDIA_CONTROLS_SCRIPT)
     bool mediaControlsDependOnPageScaleFactor() const { return m_mediaControlsDependOnPageScaleFactor; }
     void setMediaControlsDependOnPageScaleFactor(bool);
+    void updateMediaControlsAfterPresentationModeChange();
 #endif
 
     void scheduleEvent(const AtomicString& eventName);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to