Title: [109483] trunk
Revision
109483
Author
[email protected]
Date
2012-03-01 18:39:38 -0800 (Thu, 01 Mar 2012)

Log Message

Custom scrollbars do not support transparency
https://bugs.webkit.org/show_bug.cgi?id=50547

Source/WebCore:

Patch by Hajime Morrita <[email protected]> on 2012-03-01
Reviewed by James Robinson.

RenderScrollbar, which is used even for outermost frame when
-webkit-scrollbar is specified, assumes that its background is
painted by the enclosing container. But there is no such container
for outermost frame. This causes visual glitches when the
scrollbar has transparency.

This change clears background region for custom
outermostscrollbars to erase such glitches.

Test: fast/frames/transparent-scrollbar.html

* page/FrameView.cpp:
(WebCore::FrameView::paintScrollbar): The background is cleared here.
(WebCore):
* page/FrameView.h:
(FrameView):
* platform/ScrollView.cpp:
(WebCore::ScrollView::paintScrollbar): Added to hook in FrameView
(WebCore):
(WebCore::ScrollView::paintScrollbars):
* platform/ScrollView.h:
(ScrollView):

LayoutTests:

Reviewed by James Robinson.

* fast/frames/transparent-scrollbar.html: Added.
* fast/frames/transparent-scrollbar-expected.txt: Added.
* platform/chromium-linux/fast/frames/transparent-scrollbar-expected.png: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (109482 => 109483)


--- trunk/LayoutTests/ChangeLog	2012-03-02 02:35:14 UTC (rev 109482)
+++ trunk/LayoutTests/ChangeLog	2012-03-02 02:39:38 UTC (rev 109483)
@@ -1,3 +1,14 @@
+2012-03-01  MORITA Hajime  <[email protected]>
+
+        Custom scrollbars do not support transparency
+        https://bugs.webkit.org/show_bug.cgi?id=50547
+
+        Reviewed by James Robinson.
+
+        * fast/frames/transparent-scrollbar.html: Added.
+        * fast/frames/transparent-scrollbar-expected.txt: Added.
+        * platform/chromium-linux/fast/frames/transparent-scrollbar-expected.png: Added.
+
 2012-03-01  Kent Tamura  <[email protected]>
 
         REGRESSION(r106388): Form state is restored to a wrong document.

Added: trunk/LayoutTests/fast/frames/transparent-scrollbar-expected.txt (0 => 109483)


--- trunk/LayoutTests/fast/frames/transparent-scrollbar-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/frames/transparent-scrollbar-expected.txt	2012-03-02 02:39:38 UTC (rev 109483)
@@ -0,0 +1 @@
+PASS if blue scrollbar is at the bottom.
Property changes on: trunk/LayoutTests/fast/frames/transparent-scrollbar-expected.txt
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/frames/transparent-scrollbar.html (0 => 109483)


--- trunk/LayoutTests/fast/frames/transparent-scrollbar.html	                        (rev 0)
+++ trunk/LayoutTests/fast/frames/transparent-scrollbar.html	2012-03-02 02:39:38 UTC (rev 109483)
@@ -0,0 +1,42 @@
+<html>
+<head>
+<style>
+::-webkit-scrollbar {
+    height: 30px;
+    width: 30px;
+}
+
+::-webkit-scrollbar-thumb {
+    background-color: blue;
+    height: 30px;
+    width: 30px;
+}
+
+body {
+  background-color: black;
+}
+
+</style>
+<script>
+function test()
+{
+    if (window.layoutTestController) {
+        layoutTestController.waitUntilDone();
+        layoutTestController.dumpAsText(true);
+        layoutTestController.display();
+    }
+
+    window.setTimeout(function() {
+        document.body.scrollTop = 2000;
+        if (window.layoutTestController) {
+            layoutTestController.display();
+            layoutTestController.notifyDone();
+        }
+    }, 0);
+}
+</script>
+</head>
+<body _onload_="test()">
+<div style="height: 2000px; color: white;">PASS if blue scrollbar is at the bottom.</div>
+</body>
+</head>
Property changes on: trunk/LayoutTests/fast/frames/transparent-scrollbar.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/platform/chromium-linux/fast/frames/transparent-scrollbar-expected.png


(Binary files differ)
Property changes on: trunk/LayoutTests/platform/chromium-linux/fast/frames/transparent-scrollbar-expected.png ___________________________________________________________________

Added: svn:mime-type

Modified: trunk/Source/WebCore/ChangeLog (109482 => 109483)


--- trunk/Source/WebCore/ChangeLog	2012-03-02 02:35:14 UTC (rev 109482)
+++ trunk/Source/WebCore/ChangeLog	2012-03-02 02:39:38 UTC (rev 109483)
@@ -1,3 +1,33 @@
+2012-03-01  Hajime Morrita  <[email protected]>
+
+        Custom scrollbars do not support transparency
+        https://bugs.webkit.org/show_bug.cgi?id=50547
+
+        Reviewed by James Robinson.
+
+        RenderScrollbar, which is used even for outermost frame when
+        -webkit-scrollbar is specified, assumes that its background is
+        painted by the enclosing container. But there is no such container
+        for outermost frame. This causes visual glitches when the
+        scrollbar has transparency.
+
+        This change clears background region for custom
+        outermostscrollbars to erase such glitches.
+
+        Test: fast/frames/transparent-scrollbar.html
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::paintScrollbar): The background is cleared here.
+        (WebCore):
+        * page/FrameView.h:
+        (FrameView):
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::paintScrollbar): Added to hook in FrameView
+        (WebCore):
+        (WebCore::ScrollView::paintScrollbars):
+        * platform/ScrollView.h:
+        (ScrollView):
+
 2012-03-01  Kent Tamura  <[email protected]>
 
         REGRESSION(r106388): Form state is restored to a wrong document.

Modified: trunk/Source/WebCore/page/FrameView.cpp (109482 => 109483)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-03-02 02:35:14 UTC (rev 109482)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-03-02 02:39:38 UTC (rev 109483)
@@ -2702,6 +2702,9 @@
     }
 
     if (m_scrollCorner) {
+        bool needsBackgorund = m_frame->page() && m_frame->page()->mainFrame() == m_frame;
+        if (needsBackgorund)
+            context->fillRect(cornerRect, baseBackgroundColor(), ColorSpaceDeviceRGB);
         m_scrollCorner->paintIntoRect(context, cornerRect.location(), cornerRect);
         return;
     }
@@ -2709,6 +2712,18 @@
     ScrollView::paintScrollCorner(context, cornerRect);
 }
 
+void FrameView::paintScrollbar(GraphicsContext* context, Scrollbar* bar, const IntRect& rect)
+{
+    bool needsBackgorund = bar->isCustomScrollbar() && (m_frame->page() && m_frame->page()->mainFrame() == m_frame);
+    if (needsBackgorund) {
+        IntRect toFill = bar->frameRect();
+        toFill.intersect(rect);
+        context->fillRect(toFill, baseBackgroundColor(), ColorSpaceDeviceRGB);
+    }
+
+    ScrollView::paintScrollbar(context, bar, rect);
+}
+
 Color FrameView::documentBackgroundColor() const
 {
     // <https://bugs.webkit.org/show_bug.cgi?id=59540> We blend the background color of

Modified: trunk/Source/WebCore/page/FrameView.h (109482 => 109483)


--- trunk/Source/WebCore/page/FrameView.h	2012-03-02 02:35:14 UTC (rev 109482)
+++ trunk/Source/WebCore/page/FrameView.h	2012-03-02 02:39:38 UTC (rev 109483)
@@ -230,6 +230,7 @@
 
     virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
     virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
+    virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) OVERRIDE;
 
     Color documentBackgroundColor() const;
 

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (109482 => 109483)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2012-03-02 02:35:14 UTC (rev 109482)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2012-03-02 02:39:38 UTC (rev 109483)
@@ -970,6 +970,11 @@
     ScrollbarTheme::theme()->paintScrollCorner(this, context, cornerRect);
 }
 
+void ScrollView::paintScrollbar(GraphicsContext* context, Scrollbar* bar, const IntRect& rect)
+{
+    bar->paint(context, rect);
+}
+
 void ScrollView::invalidateScrollCornerRect(const IntRect& rect)
 {
     invalidateRect(rect);
@@ -982,13 +987,13 @@
         && !layerForHorizontalScrollbar()
 #endif
                                       )
-        m_horizontalScrollbar->paint(context, rect);
+        paintScrollbar(context, m_horizontalScrollbar.get(), rect);
     if (m_verticalScrollbar
 #if USE(ACCELERATED_COMPOSITING)
         && !layerForVerticalScrollbar()
 #endif
                                     )
-        m_verticalScrollbar->paint(context, rect);
+        paintScrollbar(context, m_verticalScrollbar.get(), rect);
 
 #if USE(ACCELERATED_COMPOSITING)
     if (layerForScrollCorner())

Modified: trunk/Source/WebCore/platform/ScrollView.h (109482 => 109483)


--- trunk/Source/WebCore/platform/ScrollView.h	2012-03-02 02:35:14 UTC (rev 109482)
+++ trunk/Source/WebCore/platform/ScrollView.h	2012-03-02 02:39:38 UTC (rev 109483)
@@ -272,6 +272,7 @@
     virtual bool scrollbarCornerPresent() const;
     virtual IntRect scrollCornerRect() const;
     virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
+    virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&);
 
     virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const;
     virtual IntRect convertFromContainingViewToScrollbar(const Scrollbar*, const IntRect&) const;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to