Title: [101765] trunk/Source/WebKit/gtk
Revision
101765
Author
[email protected]
Date
2011-12-02 01:18:35 -0800 (Fri, 02 Dec 2011)

Log Message

[GTK] scrollbars interfering with fullscreen (in-window) video rendering
https://bugs.webkit.org/show_bug.cgi?id=73577

Reviewed by Martin Robinson.

Disable scrollbars when switching to fullscreen.

* WebCoreSupport/ChromeClientGtk.cpp:
(WebKit::ChromeClient::contentsSizeChanged): Ignore size changes
when an element is being displayed fullscreen.
(WebKit::ChromeClient::enterFullScreenForElement): Disable
scrollbars when entering fullscreen.
* WebCoreSupport/GtkAdjustmentWatcher.cpp: Added 2 methods to
enable/disable scrollbars and one method to know whether they are
enabled or not.
(WebKit::GtkAdjustmentWatcher::GtkAdjustmentWatcher):
(WebKit::updateAdjustmentFromScrollbar):
(WebKit::GtkAdjustmentWatcher::updateAdjustmentsFromScrollbars):
(WebKit::GtkAdjustmentWatcher::updateAdjustmentsFromScrollbarsLater):
(WebKit::GtkAdjustmentWatcher::disableAllScrollbars):
(WebKit::GtkAdjustmentWatcher::enableAllScrollbars):
* WebCoreSupport/GtkAdjustmentWatcher.h:
(WebKit::GtkAdjustmentWatcher::scrollbarsDisabled):

Modified Paths

Diff

Modified: trunk/Source/WebKit/gtk/ChangeLog (101764 => 101765)


--- trunk/Source/WebKit/gtk/ChangeLog	2011-12-02 09:16:58 UTC (rev 101764)
+++ trunk/Source/WebKit/gtk/ChangeLog	2011-12-02 09:18:35 UTC (rev 101765)
@@ -1,3 +1,29 @@
+2011-12-01  Philippe Normand  <[email protected]>
+
+        [GTK] scrollbars interfering with fullscreen (in-window) video rendering
+        https://bugs.webkit.org/show_bug.cgi?id=73577
+
+        Reviewed by Martin Robinson.
+
+        Disable scrollbars when switching to fullscreen.
+
+        * WebCoreSupport/ChromeClientGtk.cpp:
+        (WebKit::ChromeClient::contentsSizeChanged): Ignore size changes
+        when an element is being displayed fullscreen.
+        (WebKit::ChromeClient::enterFullScreenForElement): Disable
+        scrollbars when entering fullscreen.
+        * WebCoreSupport/GtkAdjustmentWatcher.cpp: Added 2 methods to
+        enable/disable scrollbars and one method to know whether they are
+        enabled or not.
+        (WebKit::GtkAdjustmentWatcher::GtkAdjustmentWatcher):
+        (WebKit::updateAdjustmentFromScrollbar):
+        (WebKit::GtkAdjustmentWatcher::updateAdjustmentsFromScrollbars):
+        (WebKit::GtkAdjustmentWatcher::updateAdjustmentsFromScrollbarsLater):
+        (WebKit::GtkAdjustmentWatcher::disableAllScrollbars):
+        (WebKit::GtkAdjustmentWatcher::enableAllScrollbars):
+        * WebCoreSupport/GtkAdjustmentWatcher.h:
+        (WebKit::GtkAdjustmentWatcher::scrollbarsDisabled):
+
 2011-11-21  Philippe Normand  <[email protected]>
 
         [GTK] enable-webaudio websetting

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp (101764 => 101765)


--- trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2011-12-02 09:16:58 UTC (rev 101764)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp	2011-12-02 09:18:35 UTC (rev 101765)
@@ -636,6 +636,9 @@
 
 void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
 {
+    if (m_adjustmentWatcher.scrollbarsDisabled())
+        return;
+
     // We need to queue a resize request only if the size changed,
     // otherwise we get into an infinite loop!
     GtkWidget* widget = GTK_WIDGET(m_webView);
@@ -886,12 +889,14 @@
 void ChromeClient::enterFullScreenForElement(WebCore::Element* element)
 {
     element->document()->webkitWillEnterFullScreenForElement(element);
+    m_adjustmentWatcher.disableAllScrollbars();
     element->document()->webkitDidEnterFullScreenForElement(element);
 }
 
 void ChromeClient::exitFullScreenForElement(WebCore::Element* element)
 {
     element->document()->webkitWillExitFullScreenForElement(element);
+    m_adjustmentWatcher.enableAllScrollbars();
     element->document()->webkitDidExitFullScreenForElement(element);
 }
 #endif

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp (101764 => 101765)


--- trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp	2011-12-02 09:16:58 UTC (rev 101764)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.cpp	2011-12-02 09:18:35 UTC (rev 101765)
@@ -32,6 +32,7 @@
 
 GtkAdjustmentWatcher::GtkAdjustmentWatcher(WebKitWebView* webView)
     : m_webView(webView)
+    , m_scrollbarsDisabled(false)
     , m_handlingGtkAdjustmentChange(false)
     , m_updateAdjustmentCallbackId(0)
 {
@@ -57,6 +58,8 @@
 
 void GtkAdjustmentWatcher::updateAdjustmentsFromScrollbars()
 {
+    if (m_scrollbarsDisabled)
+        return;
     if (m_handlingGtkAdjustmentChange)
         return;
     if (!core(m_webView) || !core(m_webView)->mainFrame())
@@ -77,7 +80,7 @@
 void GtkAdjustmentWatcher::updateAdjustmentsFromScrollbarsLater() const
 {
     // We've already scheduled an update. No need to schedule another.
-    if (m_updateAdjustmentCallbackId)
+    if (m_updateAdjustmentCallbackId || m_scrollbarsDisabled)
         return;
 
     // The fact that this method was called means that we need to update the scrollbars, but at the
@@ -130,5 +133,18 @@
     }
 }
 
+void GtkAdjustmentWatcher::disableAllScrollbars()
+{
+    updateAdjustmentFromScrollbar(m_horizontalAdjustment.get(), 0);
+    updateAdjustmentFromScrollbar(m_verticalAdjustment.get(), 0);
+    m_scrollbarsDisabled = true;
+}
+
+void GtkAdjustmentWatcher::enableAllScrollbars()
+{
+    m_scrollbarsDisabled = false;
+    updateAdjustmentsFromScrollbars();
+}
+
 } // namespace WebKit
 

Modified: trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.h (101764 => 101765)


--- trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.h	2011-12-02 09:16:58 UTC (rev 101764)
+++ trunk/Source/WebKit/gtk/WebCoreSupport/GtkAdjustmentWatcher.h	2011-12-02 09:18:35 UTC (rev 101765)
@@ -38,11 +38,15 @@
     void adjustmentValueChanged(GtkAdjustment*);
     void updateAdjustmentsFromScrollbars();
     void updateAdjustmentsFromScrollbarsLater() const;
+    void disableAllScrollbars();
+    void enableAllScrollbars();
+    bool scrollbarsDisabled() const { return m_scrollbarsDisabled; };
 
 private:
     WebKitWebView* m_webView;
     GRefPtr<GtkAdjustment> m_horizontalAdjustment;
     GRefPtr<GtkAdjustment> m_verticalAdjustment;
+    bool m_scrollbarsDisabled;
     bool m_handlingGtkAdjustmentChange;
     mutable unsigned m_updateAdjustmentCallbackId;
 };
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to