[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

bdakin at apple.com bdakin at apple.com
Sun Feb 20 23:17:31 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit a9d8d857ed249a9f30d93b1c91abdb4f23b88273
Author: bdakin at apple.com <bdakin at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Jan 19 18:49:35 2011 +0000

    Fix for <rdar://problem/8882916> Overlay scrollers require
    content to layout underneath the scrollbar area
    
    Reviewed by Maciej Stachowiak.
    
    The render tree should not include scrollbar size for
    overlay scrollers. This patch will allow scrollers on
    the WebView to behave like overflow:overlay.
    
    Treat overlay scrollers the same way as the !includeScrollbars
    case.
    * platform/ScrollView.cpp:
    (WebCore::ScrollView::visibleContentRect):
    
    No corner rect for overlay scrollers.
    (WebCore::ScrollView::scrollCornerRect):
    
    usesOverlayScrollbars() currently always returns no.
    * platform/ScrollbarTheme.h:
    (WebCore::ScrollbarTheme::usesOverlayScrollbars):
    * platform/mac/ScrollbarThemeMac.h:
    * platform/mac/ScrollbarThemeMac.mm:
    (WebCore::ScrollbarThemeMac::usesOverlayScrollbars):
    
    includeVerticalScrollbarSize() and includeHorizontalScrollbarSize()
    should return false for overlay scrollers. They already return
    false for overflow:overlay.
    * rendering/RenderBox.cpp:
    (WebCore::RenderBox::includeVerticalScrollbarSize):
    (WebCore::RenderBox::includeHorizontalScrollbarSize):
    * rendering/RenderBox.h:
    
    In the render tree, always treat overlay scrollers like
    they have a width and height of 0.
    * rendering/RenderLayer.cpp:
    (WebCore::RenderLayer::verticalScrollbarWidth):
    (WebCore::RenderLayer::horizontalScrollbarHeight):
    * rendering/RenderListBox.cpp:
    (WebCore::RenderListBox::verticalScrollbarWidth):
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76141 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index e428d33..68ca15b 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,45 @@
+2011-01-18  Beth Dakin  <bdakin at apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        Fix for <rdar://problem/8882916> Overlay scrollers require 
+        content to layout underneath the scrollbar area
+
+        The render tree should not include scrollbar size for
+        overlay scrollers. This patch will allow scrollers on
+        the WebView to behave like overflow:overlay.
+
+        Treat overlay scrollers the same way as the !includeScrollbars
+        case.
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::visibleContentRect):
+
+        No corner rect for overlay scrollers.
+        (WebCore::ScrollView::scrollCornerRect):
+
+        usesOverlayScrollbars() currently always returns no.
+        * platform/ScrollbarTheme.h:
+        (WebCore::ScrollbarTheme::usesOverlayScrollbars):
+        * platform/mac/ScrollbarThemeMac.h:
+        * platform/mac/ScrollbarThemeMac.mm:
+        (WebCore::ScrollbarThemeMac::usesOverlayScrollbars):
+
+        includeVerticalScrollbarSize() and includeHorizontalScrollbarSize()
+        should return false for overlay scrollers. They already return
+        false for overflow:overlay.
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::includeVerticalScrollbarSize):
+        (WebCore::RenderBox::includeHorizontalScrollbarSize):
+        * rendering/RenderBox.h:
+
+        In the render tree, always treat overlay scrollers like
+        they have a width and height of 0.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::verticalScrollbarWidth):
+        (WebCore::RenderLayer::horizontalScrollbarHeight):
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::verticalScrollbarWidth):
+
 2011-01-18  Evan Martin  <evan at chromium.org>
 
         Reviewed by Tony Chang.
diff --git a/Source/WebCore/platform/ScrollView.cpp b/Source/WebCore/platform/ScrollView.cpp
index 6cf13a4..dad73bf 100644
--- a/Source/WebCore/platform/ScrollView.cpp
+++ b/Source/WebCore/platform/ScrollView.cpp
@@ -229,9 +229,15 @@ IntRect ScrollView::visibleContentRect(bool includeScrollbars) const
     if (paintsEntireContents())
         return IntRect(IntPoint(0, 0), contentsSize());
 
+    bool hasOverlayScrollbars = ScrollbarTheme::nativeTheme()->usesOverlayScrollbars();
+    int verticalScrollbarWidth = verticalScrollbar() && !hasOverlayScrollbars && !includeScrollbars
+        ? verticalScrollbar()->width() : 0;
+    int horizontalScrollbarHeight = horizontalScrollbar() && !hasOverlayScrollbars && !includeScrollbars
+        ? horizontalScrollbar()->height() : 0;
+
     return IntRect(IntPoint(m_scrollOffset.width(), m_scrollOffset.height()),
-                   IntSize(max(0, width() - (verticalScrollbar() && !includeScrollbars ? verticalScrollbar()->width() : 0)), 
-                           max(0, height() - (horizontalScrollbar() && !includeScrollbars ? horizontalScrollbar()->height() : 0))));
+                   IntSize(max(0, width() - verticalScrollbarWidth), 
+                           max(0, height() - horizontalScrollbarHeight)));
 }
 #endif
 
@@ -824,7 +830,10 @@ void ScrollView::repaintContentRectangle(const IntRect& rect, bool now)
 IntRect ScrollView::scrollCornerRect() const
 {
     IntRect cornerRect;
-    
+
+    if (ScrollbarTheme::nativeTheme()->usesOverlayScrollbars())
+        return cornerRect;
+
     if (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() > 0) {
         cornerRect.unite(IntRect(m_horizontalScrollbar->width(),
                                  height() - m_horizontalScrollbar->height(),
diff --git a/Source/WebCore/platform/ScrollbarTheme.h b/Source/WebCore/platform/ScrollbarTheme.h
index 0efaf7a..4e9e24b 100644
--- a/Source/WebCore/platform/ScrollbarTheme.h
+++ b/Source/WebCore/platform/ScrollbarTheme.h
@@ -48,6 +48,7 @@ public:
     virtual ScrollbarButtonsPlacement buttonsPlacement() const { return ScrollbarButtonsSingle; }
 
     virtual bool supportsControlTints() const { return false; }
+    virtual bool usesOverlayScrollbars() const { return false; }
 
     virtual void themeChanged() {}
     
diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.h b/Source/WebCore/platform/mac/ScrollbarThemeMac.h
index c833ee7..8b5412d 100644
--- a/Source/WebCore/platform/mac/ScrollbarThemeMac.h
+++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.h
@@ -40,6 +40,7 @@ public:
     virtual int scrollbarThickness(ScrollbarControlSize = RegularScrollbar);
     
     virtual bool supportsControlTints() const { return true; }
+    virtual bool usesOverlayScrollbars() const;
 
     virtual double initialAutoscrollTimerDelay();
     virtual double autoscrollTimerDelay();
diff --git a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
index ce3be1a..3266b8f 100644
--- a/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
+++ b/Source/WebCore/platform/mac/ScrollbarThemeMac.mm
@@ -165,6 +165,12 @@ int ScrollbarThemeMac::scrollbarThickness(ScrollbarControlSize controlSize)
     return cScrollbarThickness[controlSize];
 }
 
+bool ScrollbarThemeMac::usesOverlayScrollbars() const
+{
+    // FIXME: This should be enabled when <rdar://problem/8492788> is resolved.
+    return false;
+}
+
 double ScrollbarThemeMac::initialAutoscrollTimerDelay()
 {
     return gInitialButtonDelay;
diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp
index 5c0e611..36c24b7 100644
--- a/Source/WebCore/rendering/RenderBox.cpp
+++ b/Source/WebCore/rendering/RenderBox.cpp
@@ -47,6 +47,7 @@
 #include "RenderTableCell.h"
 #include "RenderTheme.h"
 #include "RenderView.h"
+#include "ScrollbarTheme.h"
 #include "TransformState.h"
 #include <algorithm>
 #include <math.h>
@@ -562,6 +563,18 @@ IntRect RenderBox::reflectedRect(const IntRect& r) const
     return result;
 }
 
+bool RenderBox::includeVerticalScrollbarSize() const
+{
+    return !ScrollbarTheme::nativeTheme()->usesOverlayScrollbars() 
+        && hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO);
+}
+
+bool RenderBox::includeHorizontalScrollbarSize() const
+{
+    return !ScrollbarTheme::nativeTheme()->usesOverlayScrollbars()
+        && hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO);
+}
+
 int RenderBox::verticalScrollbarWidth() const
 {
     return includeVerticalScrollbarSize() ? layer()->verticalScrollbarWidth() : 0;
diff --git a/Source/WebCore/rendering/RenderBox.h b/Source/WebCore/rendering/RenderBox.h
index e784b93..7bc4910 100644
--- a/Source/WebCore/rendering/RenderBox.h
+++ b/Source/WebCore/rendering/RenderBox.h
@@ -410,8 +410,8 @@ protected:
     virtual void mapAbsoluteToLocalPoint(bool fixed, bool useTransforms, TransformState&) const;
 
 private:
-    bool includeVerticalScrollbarSize() const { return hasOverflowClip() && (style()->overflowY() == OSCROLL || style()->overflowY() == OAUTO); }
-    bool includeHorizontalScrollbarSize() const { return hasOverflowClip() && (style()->overflowX() == OSCROLL || style()->overflowX() == OAUTO); }
+    bool includeVerticalScrollbarSize() const;
+    bool includeHorizontalScrollbarSize() const;
 
     void paintRootBoxDecorations(PaintInfo&, int tx, int ty);
     // Returns true if we did a full repaint
diff --git a/Source/WebCore/rendering/RenderLayer.cpp b/Source/WebCore/rendering/RenderLayer.cpp
index df55602..32b4f5b 100644
--- a/Source/WebCore/rendering/RenderLayer.cpp
+++ b/Source/WebCore/rendering/RenderLayer.cpp
@@ -1886,14 +1886,14 @@ void RenderLayer::setHasVerticalScrollbar(bool hasScrollbar)
 
 int RenderLayer::verticalScrollbarWidth() const
 {
-    if (!m_vBar)
+    if (!m_vBar || ScrollbarTheme::nativeTheme()->usesOverlayScrollbars())
         return 0;
     return m_vBar->width();
 }
 
 int RenderLayer::horizontalScrollbarHeight() const
 {
-    if (!m_hBar)
+    if (!m_hBar || ScrollbarTheme::nativeTheme()->usesOverlayScrollbars())
         return 0;
     return m_hBar->height();
 }
diff --git a/Source/WebCore/rendering/RenderListBox.cpp b/Source/WebCore/rendering/RenderListBox.cpp
index e6ce340..e0cd0af 100644
--- a/Source/WebCore/rendering/RenderListBox.cpp
+++ b/Source/WebCore/rendering/RenderListBox.cpp
@@ -51,6 +51,7 @@
 #include "RenderTheme.h"
 #include "RenderView.h"
 #include "Scrollbar.h"
+#include "ScrollbarTheme.h"
 #include "SelectElement.h"
 #include "SelectionController.h"
 #include "NodeRenderStyle.h"
@@ -551,7 +552,7 @@ int RenderListBox::itemHeight() const
 
 int RenderListBox::verticalScrollbarWidth() const
 {
-    return m_vBar ? m_vBar->width() : 0;
+    return m_vBar && !ScrollbarTheme::nativeTheme()->usesOverlayScrollbars() ? m_vBar->width() : 0;
 }
 
 // FIXME: We ignore padding in the vertical direction as far as these values are concerned, since that's

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list