Title: [167630] trunk/Source
Revision
167630
Author
[email protected]
Date
2014-04-21 15:22:35 -0700 (Mon, 21 Apr 2014)

Log Message

topContentInset does not play well with fullscreen elements
https://bugs.webkit.org/show_bug.cgi?id=131955
-and corresponding-
<rdar://problem/16651925>

Reviewed by Sam Weinig.


Source/WebCore: 
Calling setNeedsLayout() is not sufficient when the topContentInset has changed 
dynamically. We need to perform the layout right away and update the scrollbars. 
This works completely when the inset changes due to entering/exiting fullscreen, 
but I left a FIXME behind because it is possible to change the inset dynamically 
just through the WK2 API and end up in a situation where everything looks right 
except for the scrollbars. 
* page/FrameView.cpp:
(WebCore::FrameView::topContentInsetDidChange):
* page/FrameView.h:
* page/Page.cpp:
(WebCore::Page::setTopContentInset):

Source/WebKit2: 
If you take an element (such as a <video>) fullscreen when you have a 
topContentInset set, there will be an inset-sized gap at the top of the fullscreen 
video.

Save and restore the topContentInset whenever the scroll position is saved and 
restored.
* WebProcess/FullScreen/WebFullScreenManager.cpp:
(WebKit::WebFullScreenManager::WebFullScreenManager):
(WebKit::WebFullScreenManager::saveScrollPosition):
(WebKit::WebFullScreenManager::restoreScrollPosition):
* WebProcess/FullScreen/WebFullScreenManager.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (167629 => 167630)


--- trunk/Source/WebCore/ChangeLog	2014-04-21 21:49:04 UTC (rev 167629)
+++ trunk/Source/WebCore/ChangeLog	2014-04-21 22:22:35 UTC (rev 167630)
@@ -1,3 +1,24 @@
+2014-04-21  Beth Dakin  <[email protected]>
+
+        topContentInset does not play well with fullscreen elements
+        https://bugs.webkit.org/show_bug.cgi?id=131955
+        -and corresponding-
+        <rdar://problem/16651925>
+
+        Reviewed by Sam Weinig.
+
+        Calling setNeedsLayout() is not sufficient when the topContentInset has changed 
+        dynamically. We need to perform the layout right away and update the scrollbars. 
+        This works completely when the inset changes due to entering/exiting fullscreen, 
+        but I left a FIXME behind because it is possible to change the inset dynamically 
+        just through the WK2 API and end up in a situation where everything looks right 
+        except for the scrollbars. 
+        * page/FrameView.cpp:
+        (WebCore::FrameView::topContentInsetDidChange):
+        * page/FrameView.h:
+        * page/Page.cpp:
+        (WebCore::Page::setTopContentInset):
+
 2014-04-18  Jon Honeycutt  <[email protected]>
 
         Empty RenderInline objects should not be line break objects.

Modified: trunk/Source/WebCore/page/FrameView.cpp (167629 => 167630)


--- trunk/Source/WebCore/page/FrameView.cpp	2014-04-21 21:49:04 UTC (rev 167629)
+++ trunk/Source/WebCore/page/FrameView.cpp	2014-04-21 22:22:35 UTC (rev 167630)
@@ -950,6 +950,18 @@
     return page ? page->topContentInset() : 0;
 }
     
+void FrameView::topContentInsetDidChange()
+{
+    RenderView* renderView = this->renderView();
+    if (!renderView)
+        return;
+    
+    // FIXME: <rdar://problem/16642232> This call to updateScrollbars() is not actually sufficient to fix
+    // the scrollbars if the contentInset changes dynamically. 
+    layout();
+    updateScrollbars(scrollOffset());
+}
+    
 bool FrameView::hasCompositedContent() const
 {
     if (RenderView* renderView = this->renderView())

Modified: trunk/Source/WebCore/page/FrameView.h (167629 => 167630)


--- trunk/Source/WebCore/page/FrameView.h	2014-04-21 21:49:04 UTC (rev 167629)
+++ trunk/Source/WebCore/page/FrameView.h	2014-04-21 22:22:35 UTC (rev 167630)
@@ -454,6 +454,7 @@
     void setFooterHeight(int);
 
     virtual float topContentInset() const override;
+    void topContentInsetDidChange();
 
     virtual void willStartLiveResize() override;
     virtual void willEndLiveResize() override;

Modified: trunk/Source/WebCore/page/Page.cpp (167629 => 167630)


--- trunk/Source/WebCore/page/Page.cpp	2014-04-21 21:49:04 UTC (rev 167629)
+++ trunk/Source/WebCore/page/Page.cpp	2014-04-21 22:22:35 UTC (rev 167630)
@@ -779,8 +779,9 @@
         return;
     
     m_topContentInset = contentInset;
-    if (RenderView* renderView = mainFrame().contentRenderer())
-        renderView->setNeedsLayout();
+    
+    if (FrameView* view = mainFrame().view())
+        view->topContentInsetDidChange();
 }
     
 void Page::setShouldSuppressScrollbarAnimations(bool suppressAnimations)

Modified: trunk/Source/WebKit2/ChangeLog (167629 => 167630)


--- trunk/Source/WebKit2/ChangeLog	2014-04-21 21:49:04 UTC (rev 167629)
+++ trunk/Source/WebKit2/ChangeLog	2014-04-21 22:22:35 UTC (rev 167630)
@@ -1,3 +1,24 @@
+2014-04-21  Beth Dakin  <[email protected]>
+
+        topContentInset does not play well with fullscreen elements
+        https://bugs.webkit.org/show_bug.cgi?id=131955
+        -and corresponding-
+        <rdar://problem/16651925>
+
+        Reviewed by Sam Weinig.
+
+        If you take an element (such as a <video>) fullscreen when you have a 
+        topContentInset set, there will be an inset-sized gap at the top of the fullscreen 
+        video.
+
+        Save and restore the topContentInset whenever the scroll position is saved and 
+        restored.
+        * WebProcess/FullScreen/WebFullScreenManager.cpp:
+        (WebKit::WebFullScreenManager::WebFullScreenManager):
+        (WebKit::WebFullScreenManager::saveScrollPosition):
+        (WebKit::WebFullScreenManager::restoreScrollPosition):
+        * WebProcess/FullScreen/WebFullScreenManager.h:
+
 2014-04-21  Gavin Barraclough  <[email protected]>
 
         Don't use ProcessAssertion on simulator

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp (167629 => 167630)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2014-04-21 21:49:04 UTC (rev 167629)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.cpp	2014-04-21 22:22:35 UTC (rev 167630)
@@ -65,7 +65,8 @@
 }
 
 WebFullScreenManager::WebFullScreenManager(WebPage* page)
-    : m_page(page)
+    : m_topContentInset(0)
+    , m_page(page)
 {
 }
     
@@ -156,10 +157,13 @@
 void WebFullScreenManager::saveScrollPosition()
 {
     m_scrollPosition = m_page->corePage()->mainFrame().view()->scrollPosition();
+    m_topContentInset = m_page->corePage()->topContentInset();
+    m_page->corePage()->setTopContentInset(0);
 }
 
 void WebFullScreenManager::restoreScrollPosition()
 {
+    m_page->corePage()->setTopContentInset(m_topContentInset);
     m_page->corePage()->mainFrame().view()->setScrollPosition(m_scrollPosition);
 }
 

Modified: trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h (167629 => 167630)


--- trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h	2014-04-21 21:49:04 UTC (rev 167629)
+++ trunk/Source/WebKit2/WebProcess/FullScreen/WebFullScreenManager.h	2014-04-21 22:22:35 UTC (rev 167630)
@@ -79,6 +79,7 @@
     WebCore::IntRect m_initialFrame;
     WebCore::IntRect m_finalFrame;
     WebCore::IntPoint m_scrollPosition;
+    float m_topContentInset;
     RefPtr<WebPage> m_page;
     RefPtr<WebCore::Element> m_element;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to