Title: [201963] trunk/Source
Revision
201963
Author
[email protected]
Date
2016-06-10 21:37:06 -0700 (Fri, 10 Jun 2016)

Log Message

Use the video element's video box when getting the inline video rect in WebVideoFullscreenManager
https://bugs.webkit.org/show_bug.cgi?id=158351
<rdar://problem/26567938>

Reviewed by Darin Adler.

Source/WebCore:

* WebCore.xcodeproj/project.pbxproj:
Change the visibility of RenderVideo.h and RenderMedia.h since we'll be importing RenderVideo.h from WebKit2.
* rendering/RenderVideo.h:

Source/WebKit2:

* WebProcess/cocoa/WebVideoFullscreenManager.mm:
(WebKit::inlineVideoFrame):
(WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
(WebKit::WebVideoFullscreenManager::exitVideoFullscreenForVideoElement):
(WebKit::WebVideoFullscreenManager::fullscreenMayReturnToInline):
(WebKit::WebVideoFullscreenManager::setVideoLayerFrameFenced):
(WebKit::clientRectForElement): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (201962 => 201963)


--- trunk/Source/WebCore/ChangeLog	2016-06-11 04:24:27 UTC (rev 201962)
+++ trunk/Source/WebCore/ChangeLog	2016-06-11 04:37:06 UTC (rev 201963)
@@ -1,3 +1,15 @@
+2016-06-10  Ada Chan  <[email protected]>
+
+        Use the video element's video box when getting the inline video rect in WebVideoFullscreenManager
+        https://bugs.webkit.org/show_bug.cgi?id=158351
+        <rdar://problem/26567938>
+
+        Reviewed by Darin Adler.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        Change the visibility of RenderVideo.h and RenderMedia.h since we'll be importing RenderVideo.h from WebKit2.
+        * rendering/RenderVideo.h:
+
 2016-06-10  Benjamin Poulain  <[email protected]>
 
         Add support for passive event listeners on touch events

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (201962 => 201963)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-06-11 04:24:27 UTC (rev 201962)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2016-06-11 04:37:06 UTC (rev 201963)
@@ -6639,7 +6639,7 @@
 		E446143B0CD689CC00FADA75 /* JSHTMLSourceElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B423710CBFB6E000AF2ECE /* JSHTMLSourceElement.cpp */; };
 		E446143C0CD689CC00FADA75 /* JSHTMLSourceElement.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B423720CBFB6E000AF2ECE /* JSHTMLSourceElement.h */; };
 		E44614510CD68A3500FADA75 /* RenderVideo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4B41E330CBFB60900AF2ECE /* RenderVideo.cpp */; };
-		E44614520CD68A3500FADA75 /* RenderVideo.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E340CBFB60900AF2ECE /* RenderVideo.h */; };
+		E44614520CD68A3500FADA75 /* RenderVideo.h in Headers */ = {isa = PBXBuildFile; fileRef = E4B41E340CBFB60900AF2ECE /* RenderVideo.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E44B4BB3141650D7002B1D8B /* SelectorChecker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44B4BB1141650D7002B1D8B /* SelectorChecker.cpp */; };
 		E44B4BB4141650D7002B1D8B /* SelectorChecker.h in Headers */ = {isa = PBXBuildFile; fileRef = E44B4BB2141650D7002B1D8B /* SelectorChecker.h */; };
 		E44EE3A817577EBD00EEE8CF /* FontGenericFamilies.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E44EE3A617576E5500EEE8CF /* FontGenericFamilies.cpp */; };
@@ -6710,7 +6710,7 @@
 		E4C1789A0EE6903800824D69 /* CSSSelectorList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C178950EE6903800824D69 /* CSSSelectorList.cpp */; };
 		E4C1789B0EE6903800824D69 /* CSSSelectorList.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C178960EE6903800824D69 /* CSSSelectorList.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E4C279580CF9741900E97B98 /* RenderMedia.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E4C279560CF9741900E97B98 /* RenderMedia.cpp */; };
-		E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C279570CF9741900E97B98 /* RenderMedia.h */; };
+		E4C279590CF9741900E97B98 /* RenderMedia.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C279570CF9741900E97B98 /* RenderMedia.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E4C3B1FA0F0E4161009693F6 /* LegacyTileCache.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C3B1F90F0E4161009693F6 /* LegacyTileCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		E4C3B1FC0F0E4170009693F6 /* LegacyTileCache.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4C3B1FB0F0E4170009693F6 /* LegacyTileCache.mm */; };
 		E4C91A0E1802343100A17F6D /* TextPaintStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = E4C91A0D1802343100A17F6D /* TextPaintStyle.h */; };

Modified: trunk/Source/WebCore/rendering/RenderVideo.h (201962 => 201963)


--- trunk/Source/WebCore/rendering/RenderVideo.h	2016-06-11 04:24:27 UTC (rev 201962)
+++ trunk/Source/WebCore/rendering/RenderVideo.h	2016-06-11 04:37:06 UTC (rev 201963)
@@ -39,7 +39,7 @@
 
     HTMLVideoElement& videoElement() const;
 
-    IntRect videoBox() const;
+    WEBCORE_EXPORT IntRect videoBox() const;
 
     static IntSize defaultSize();
 

Modified: trunk/Source/WebKit2/ChangeLog (201962 => 201963)


--- trunk/Source/WebKit2/ChangeLog	2016-06-11 04:24:27 UTC (rev 201962)
+++ trunk/Source/WebKit2/ChangeLog	2016-06-11 04:37:06 UTC (rev 201963)
@@ -1,3 +1,19 @@
+2016-06-10  Ada Chan  <[email protected]>
+
+        Use the video element's video box when getting the inline video rect in WebVideoFullscreenManager
+        https://bugs.webkit.org/show_bug.cgi?id=158351
+        <rdar://problem/26567938>
+
+        Reviewed by Darin Adler.
+
+        * WebProcess/cocoa/WebVideoFullscreenManager.mm:
+        (WebKit::inlineVideoFrame):
+        (WebKit::WebVideoFullscreenManager::enterVideoFullscreenForVideoElement):
+        (WebKit::WebVideoFullscreenManager::exitVideoFullscreenForVideoElement):
+        (WebKit::WebVideoFullscreenManager::fullscreenMayReturnToInline):
+        (WebKit::WebVideoFullscreenManager::setVideoLayerFrameFenced):
+        (WebKit::clientRectForElement): Deleted.
+
 2016-06-10  Benjamin Poulain  <[email protected]>
 
         Add support for passive event listeners on touch events

Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm (201962 => 201963)


--- trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm	2016-06-11 04:24:27 UTC (rev 201962)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebVideoFullscreenManager.mm	2016-06-11 04:37:06 UTC (rev 201963)
@@ -43,6 +43,7 @@
 #import <WebCore/PlatformCALayer.h>
 #import <WebCore/RenderLayer.h>
 #import <WebCore/RenderLayerBacking.h>
+#import <WebCore/RenderVideo.h>
 #import <WebCore/RenderView.h>
 #import <WebCore/Settings.h>
 #import <WebCore/TimeRanges.h>
@@ -52,12 +53,15 @@
 
 namespace WebKit {
 
-static IntRect clientRectForElement(HTMLElement* element)
+static IntRect inlineVideoFrame(HTMLVideoElement& element)
 {
-    if (!element)
-        return IntRect();
-
-    return element->clientRect();
+    element.document().updateLayoutIgnorePendingStylesheets();
+    auto* renderer = element.renderer();
+    if (!renderer)
+        return { };
+    auto rect = renderer->videoBox();
+    rect.moveBy(renderer->absoluteBoundingBoxRect().location());
+    return element.document().view()->contentsToRootView(rect);
 }
 
 #pragma mark - WebVideoFullscreenInterfaceContext
@@ -275,8 +279,8 @@
     if (!interface->layerHostingContext())
         interface->setLayerHostingContext(LayerHostingContext::createForExternalHostingProcess());
 
-    FloatRect clientRect = clientRectForElement(&videoElement);
-    FloatRect videoLayerFrame = FloatRect(0, 0, clientRect.width(), clientRect.height());
+    auto videoRect = inlineVideoFrame(videoElement);
+    FloatRect videoLayerFrame = FloatRect(0, 0, videoRect.width(), videoRect.height());
 
     HTMLMediaElementEnums::VideoFullscreenMode oldMode = interface->fullscreenMode();
     interface->setTargetIsFullscreen(true);
@@ -291,7 +295,7 @@
 
     bool allowsPictureInPicture = videoElement.mediaSession().allowsPictureInPicture(videoElement);
     
-    m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(contextId, interface->layerHostingContext()->contextID(), clientRectForElement(&videoElement), m_page->deviceScaleFactor(), interface->fullscreenMode(), allowsPictureInPicture), m_page->pageID());
+    m_page->send(Messages::WebVideoFullscreenManagerProxy::SetupFullscreenWithID(contextId, interface->layerHostingContext()->contextID(), videoRect, m_page->deviceScaleFactor(), interface->fullscreenMode(), allowsPictureInPicture), m_page->pageID());
 }
 
 void WebVideoFullscreenManager::exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement& videoElement)
@@ -307,7 +311,7 @@
         return;
 
     interface.setIsAnimating(true);
-    m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(contextId, clientRectForElement(&videoElement)), m_page->pageID());
+    m_page->send(Messages::WebVideoFullscreenManagerProxy::ExitFullscreen(contextId, inlineVideoFrame(videoElement)), m_page->pageID());
 }
 
 void WebVideoFullscreenManager::exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement& videoElement, WebCore::HTMLMediaElementEnums::VideoFullscreenMode targetMode)
@@ -464,7 +468,7 @@
 
     if (!isPageVisible)
         model.videoElement()->scrollIntoViewIfNotVisible(false);
-    m_page->send(Messages::WebVideoFullscreenManagerProxy::PreparedToReturnToInline(contextId, true, clientRectForElement(model.videoElement())), m_page->pageID());
+    m_page->send(Messages::WebVideoFullscreenManagerProxy::PreparedToReturnToInline(contextId, true, inlineVideoFrame(*model.videoElement())), m_page->pageID());
 }
     
 void WebVideoFullscreenManager::setVideoLayerFrameFenced(uint64_t contextId, WebCore::FloatRect bounds, IPC::Attachment fencePort)
@@ -474,8 +478,8 @@
     std::tie(model, interface) = ensureModelAndInterface(contextId);
 
     if (std::isnan(bounds.x()) || std::isnan(bounds.y()) || std::isnan(bounds.width()) || std::isnan(bounds.height())) {
-        FloatRect clientRect = clientRectForElement(model->videoElement());
-        bounds = FloatRect(0, 0, clientRect.width(), clientRect.height());
+        auto videoRect = inlineVideoFrame(*model->videoElement());
+        bounds = FloatRect(0, 0, videoRect.width(), videoRect.height());
     }
     
     [CATransaction begin];
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to