Changeset 109483 in webkit


Ignore:
Timestamp:
Mar 1, 2012 6:39:38 PM (12 years ago)
Author:
morrita@google.com
Message:

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

Source/WebCore:

Patch by Hajime Morrita <morrita@chromium.org> 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.
Location:
trunk
Files:
3 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r109480 r109483  
     12012-03-01  MORITA Hajime  <morrita@google.com>
     2
     3        Custom scrollbars do not support transparency
     4        https://bugs.webkit.org/show_bug.cgi?id=50547
     5
     6        Reviewed by James Robinson.
     7
     8        * fast/frames/transparent-scrollbar.html: Added.
     9        * fast/frames/transparent-scrollbar-expected.txt: Added.
     10        * platform/chromium-linux/fast/frames/transparent-scrollbar-expected.png: Added.
     11
    1122012-03-01  Kent Tamura  <tkent@chromium.org>
    213
  • trunk/Source/WebCore/ChangeLog

    r109480 r109483  
     12012-03-01  Hajime Morrita  <morrita@chromium.org>
     2
     3        Custom scrollbars do not support transparency
     4        https://bugs.webkit.org/show_bug.cgi?id=50547
     5
     6        Reviewed by James Robinson.
     7
     8        RenderScrollbar, which is used even for outermost frame when
     9        -webkit-scrollbar is specified, assumes that its background is
     10        painted by the enclosing container. But there is no such container
     11        for outermost frame. This causes visual glitches when the
     12        scrollbar has transparency.
     13
     14        This change clears background region for custom
     15        outermostscrollbars to erase such glitches.
     16
     17        Test: fast/frames/transparent-scrollbar.html
     18
     19        * page/FrameView.cpp:
     20        (WebCore::FrameView::paintScrollbar): The background is cleared here.
     21        (WebCore):
     22        * page/FrameView.h:
     23        (FrameView):
     24        * platform/ScrollView.cpp:
     25        (WebCore::ScrollView::paintScrollbar): Added to hook in FrameView
     26        (WebCore):
     27        (WebCore::ScrollView::paintScrollbars):
     28        * platform/ScrollView.h:
     29        (ScrollView):
     30
    1312012-03-01  Kent Tamura  <tkent@chromium.org>
    232
  • trunk/Source/WebCore/page/FrameView.cpp

    r109288 r109483  
    27032703
    27042704    if (m_scrollCorner) {
     2705        bool needsBackgorund = m_frame->page() && m_frame->page()->mainFrame() == m_frame;
     2706        if (needsBackgorund)
     2707            context->fillRect(cornerRect, baseBackgroundColor(), ColorSpaceDeviceRGB);
    27052708        m_scrollCorner->paintIntoRect(context, cornerRect.location(), cornerRect);
    27062709        return;
     
    27082711
    27092712    ScrollView::paintScrollCorner(context, cornerRect);
     2713}
     2714
     2715void FrameView::paintScrollbar(GraphicsContext* context, Scrollbar* bar, const IntRect& rect)
     2716{
     2717    bool needsBackgorund = bar->isCustomScrollbar() && (m_frame->page() && m_frame->page()->mainFrame() == m_frame);
     2718    if (needsBackgorund) {
     2719        IntRect toFill = bar->frameRect();
     2720        toFill.intersect(rect);
     2721        context->fillRect(toFill, baseBackgroundColor(), ColorSpaceDeviceRGB);
     2722    }
     2723
     2724    ScrollView::paintScrollbar(context, bar, rect);
    27102725}
    27112726
  • trunk/Source/WebCore/page/FrameView.h

    r109406 r109483  
    231231    virtual void paintOverhangAreas(GraphicsContext*, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect);
    232232    virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
     233    virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&) OVERRIDE;
    233234
    234235    Color documentBackgroundColor() const;
  • trunk/Source/WebCore/platform/ScrollView.cpp

    r109431 r109483  
    971971}
    972972
     973void ScrollView::paintScrollbar(GraphicsContext* context, Scrollbar* bar, const IntRect& rect)
     974{
     975    bar->paint(context, rect);
     976}
     977
    973978void ScrollView::invalidateScrollCornerRect(const IntRect& rect)
    974979{
     
    983988#endif
    984989                                      )
    985         m_horizontalScrollbar->paint(context, rect);
     990        paintScrollbar(context, m_horizontalScrollbar.get(), rect);
    986991    if (m_verticalScrollbar
    987992#if USE(ACCELERATED_COMPOSITING)
     
    989994#endif
    990995                                    )
    991         m_verticalScrollbar->paint(context, rect);
     996        paintScrollbar(context, m_verticalScrollbar.get(), rect);
    992997
    993998#if USE(ACCELERATED_COMPOSITING)
  • trunk/Source/WebCore/platform/ScrollView.h

    r108536 r109483  
    273273    virtual IntRect scrollCornerRect() const;
    274274    virtual void paintScrollCorner(GraphicsContext*, const IntRect& cornerRect);
     275    virtual void paintScrollbar(GraphicsContext*, Scrollbar*, const IntRect&);
    275276
    276277    virtual IntRect convertFromScrollbarToContainingView(const Scrollbar*, const IntRect&) const;
Note: See TracChangeset for help on using the changeset viewer.