PageBanners appear over HTML5 video when media element is in full screen mode
authorbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jun 2013 00:41:43 +0000 (00:41 +0000)
committerbdakin@apple.com <bdakin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Jun 2013 00:41:43 +0000 (00:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=117721
-and corresponding-
<rdar://problem/13686998>

Reviewed by Sam Weinig.

Source/WebCore:

Update the scrolling tree when a header/footer has been removed.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateLayerForHeader):
(WebCore::RenderLayerCompositor::updateLayerForFooter):

Source/WebKit2:

When an element enters fullscreen, hide the banners. Show them again when the
element exits fullscreen.
* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::willEnterFullScreen):
(WebKit::WebFullScreenManager::willExitFullScreen):

Handle hiding and showing by removing or re-creating a parent layer for m_layer.
* WebProcess/WebPage/PageBanner.cpp:
(WebKit::PageBanner::hide):
(WebKit::PageBanner::showIfHidden):
* WebProcess/WebPage/PageBanner.h:
* WebProcess/WebPage/mac/PageBannerMac.mm:
(WebKit::PageBanner::PageBanner):
(WebKit::PageBanner::hide):
(WebKit::PageBanner::showIfHidden):
(WebKit::PageBanner::mouseEvent):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::hidePageBanners):
(WebKit::WebPage::showPageBanners):
* WebProcess/WebPage/WebPage.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@151661 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp
Source/WebKit2/WebProcess/WebPage/PageBanner.cpp
Source/WebKit2/WebProcess/WebPage/PageBanner.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/mac/PageBannerMac.mm

index 1c1e590..b9abb5e 100644 (file)
@@ -1,3 +1,17 @@
+2013-06-17  Beth Dakin  <bdakin@apple.com>
+
+        PageBanners appear over HTML5 video when media element is in full screen mode
+        https://bugs.webkit.org/show_bug.cgi?id=117721
+        -and corresponding-
+        <rdar://problem/13686998>
+
+        Reviewed by Sam Weinig.
+
+        Update the scrolling tree when a header/footer has been removed.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateLayerForHeader):
+        (WebCore::RenderLayerCompositor::updateLayerForFooter):
+
 2013-06-17  Roger Fong  <roger_fong@apple.com>
 
         Modify Windows makefiles to copy some bin output into Program Files.
index 9c0da46..9b552f9 100644 (file)
@@ -2572,6 +2572,11 @@ GraphicsLayer* RenderLayerCompositor::updateLayerForHeader(bool wantsLayer)
         if (m_layerForHeader) {
             m_layerForHeader->removeFromParent();
             m_layerForHeader = nullptr;
+
+            // The ScrollingTree knows about the header layer, and the position of the root layer is affected
+            // by the header layer, so if we remove the header, we need to tell the scrolling tree.
+            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+                scrollingCoordinator->frameViewRootLayerDidChange(m_renderView->frameView());
         }
         return 0;
     }
@@ -2607,6 +2612,11 @@ GraphicsLayer* RenderLayerCompositor::updateLayerForFooter(bool wantsLayer)
         if (m_layerForFooter) {
             m_layerForFooter->removeFromParent();
             m_layerForFooter = nullptr;
+
+            // The ScrollingTree knows about the footer layer, and the total scrollable size is affected
+            // by the footer layer, so if we remove the footer, we need to tell the scrolling tree.
+            if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator())
+                scrollingCoordinator->frameViewRootLayerDidChange(m_renderView->frameView());
         }
         return 0;
     }
index 9b1e00e..ce21856 100644 (file)
@@ -1,3 +1,33 @@
+2013-06-17  Beth Dakin  <bdakin@apple.com>
+
+        PageBanners appear over HTML5 video when media element is in full screen mode
+        https://bugs.webkit.org/show_bug.cgi?id=117721
+        -and corresponding-
+        <rdar://problem/13686998>
+
+        Reviewed by Sam Weinig.
+
+        When an element enters fullscreen, hide the banners. Show them again when the 
+        element exits fullscreen.
+        * WebProcess/FullScreen/WebFullScreenManager.cpp:
+        (WebKit::WebFullScreenManager::willEnterFullScreen):
+        (WebKit::WebFullScreenManager::willExitFullScreen):
+
+        Handle hiding and showing by removing or re-creating a parent layer for m_layer.
+        * WebProcess/WebPage/PageBanner.cpp:
+        (WebKit::PageBanner::hide):
+        (WebKit::PageBanner::showIfHidden):
+        * WebProcess/WebPage/PageBanner.h:
+        * WebProcess/WebPage/mac/PageBannerMac.mm:
+        (WebKit::PageBanner::PageBanner):
+        (WebKit::PageBanner::hide):
+        (WebKit::PageBanner::showIfHidden):
+        (WebKit::PageBanner::mouseEvent):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::hidePageBanners):
+        (WebKit::WebPage::showPageBanners):
+        * WebProcess/WebPage/WebPage.h:
+
 2013-06-17  Ruth Fong  <ruth_fong@apple.com>
 
         REGRESSION: Important controls are missing from <video> element UI, when compared to QuickTime
index 6684156..0d28313 100644 (file)
@@ -106,6 +106,7 @@ void WebFullScreenManager::willEnterFullScreen()
 {
     ASSERT(m_element);
     m_element->document()->webkitWillEnterFullScreenForElement(m_element.get());
+    m_page->hidePageBanners();
     m_element->document()->updateLayout();
     m_page->forceRepaintWithoutCallback();
     m_finalFrame = screenRectOfContents(m_element.get());
@@ -123,6 +124,7 @@ void WebFullScreenManager::willExitFullScreen()
     ASSERT(m_element);
     m_finalFrame = screenRectOfContents(m_element.get());
     m_element->document()->webkitWillExitFullScreenForElement(m_element.get());
+    m_page->showPageBanners();
     m_page->injectedBundleFullScreenClient().beganExitFullScreen(m_page.get(), m_finalFrame, m_initialFrame);
 }
 
index e9a1c7c..8dc53b7 100644 (file)
@@ -46,6 +46,14 @@ void PageBanner::detachFromPage()
 {
 }
 
+void PageBanner::hide()
+{
+}
+
+void PageBanner::showIfHidden()
+{
+}
+
 void PageBanner::didChangeDeviceScaleFactor(float)
 {
 }
index 1fa0604..0c8f34f 100644 (file)
@@ -70,6 +70,9 @@ public:
     void addToPage(Type, WebPage*);
     void detachFromPage();
 
+    void hide();
+    void showIfHidden();
+
     bool mouseEvent(const WebMouseEvent&);
     void didChangeDeviceScaleFactor(float scaleFactor);
 
@@ -85,6 +88,7 @@ private:
     WebPage* m_webPage;
 
     bool m_mouseDownInBanner;
+    bool m_isHidden;
 
 #if PLATFORM(MAC)
     RetainPtr<CALayer> m_layer;
index 2bea1ac..12600e7 100644 (file)
@@ -1487,6 +1487,22 @@ PageBanner* WebPage::footerPageBanner()
     return m_footerBanner.get();
 }
 
+void WebPage::hidePageBanners()
+{
+    if (m_headerBanner)
+        m_headerBanner->hide();
+    if (m_footerBanner)
+        m_footerBanner->hide();
+}
+
+void WebPage::showPageBanners()
+{
+    if (m_headerBanner)
+        m_headerBanner->showIfHidden();
+    if (m_footerBanner)
+        m_footerBanner->showIfHidden();
+}
+
 PassRefPtr<WebImage> WebPage::scaledSnapshotWithOptions(const IntRect& rect, double scaleFactor, SnapshotOptions options)
 {
     FrameView* frameView = m_mainFrame->coreFrame()->view();
index 5b8f3ba..a06c6a7 100644 (file)
@@ -384,6 +384,8 @@ public:
     void setFooterPageBanner(PassRefPtr<PageBanner>);
     PageBanner* footerPageBanner();
 
+    void hidePageBanners();
+    void showPageBanners();
 
     WebCore::IntPoint screenToWindow(const WebCore::IntPoint&);
     WebCore::IntRect windowToScreen(const WebCore::IntRect&);
index aed16ae..c84bd6d 100644 (file)
@@ -44,6 +44,7 @@ PageBanner::PageBanner(CALayer *layer, int height, Client* client)
     , m_client(client)
     , m_webPage(0)
     , m_mouseDownInBanner(false)
+    , m_isHidden(false)
     , m_layer(layer)
     , m_height(height)
 {
@@ -84,6 +85,28 @@ void PageBanner::detachFromPage()
     m_webPage = 0;
 }
 
+void PageBanner::hide()
+{
+    // We can hide the banner by removing the parent layer that hosts it.
+    if (m_type == Header)
+        m_webPage->corePage()->addHeaderWithHeight(0);
+    else if (m_type == Footer)
+        m_webPage->corePage()->addFooterWithHeight(0);
+
+    m_isHidden = true;
+}
+
+void PageBanner::showIfHidden()
+{
+    if (!m_isHidden)
+        return;
+    m_isHidden = false;
+
+    // This will re-create a parent layer in the WebCore layer tree, and we will re-add
+    // m_layer as a child of it. 
+    addToPage(m_type, m_webPage);
+}
+
 void PageBanner::didChangeDeviceScaleFactor(float scaleFactor)
 {
     m_layer.get().contentsScale = scaleFactor;
@@ -92,6 +115,9 @@ void PageBanner::didChangeDeviceScaleFactor(float scaleFactor)
 
 bool PageBanner::mouseEvent(const WebMouseEvent& mouseEvent)
 {
+    if (m_isHidden)
+        return false;
+
     FrameView* frameView = m_webPage->mainFrameView();
     if (!frameView)
         return false;