Changeset 42849 in webkit


Ignore:
Timestamp:
Apr 24, 2009, 4:00:05 PM (16 years ago)
Author:
mitz@apple.com
Message:

Reviewed by Dave Hyatt.

  • WebCore.xcodeproj/project.pbxproj: Added OverlapTestRequestClient.h.
  • page/FrameView.cpp: (WebCore::FrameView::reset): Initialize m_isOverlapped. (WebCore::FrameView::useSlowRepaints): Also check m_isOverlapped. (WebCore::FrameView::removeSlowRepaintObject): Use useSlowRepaints() so overlapping is taken into account. (WebCore::FrameView::setIsOverlapped): Added. Sets m_isOverlapped and enables or disables copy-on-scroll accordingly.
  • page/FrameView.h: Added setIsOverlapped() and m_isOverlapped.
  • rendering/OverlapTestRequestClient.h: Added. During foreground painting, an OverlapTestRequestClient can make a request to test if any subsequently- painted layers overlap a rect. The test result is delivered to the requestClient via setOverlapTestResult(). (WebCore::OverlapTestRequestClient::~OverlapTestRequestClient):
  • rendering/RenderLayer.cpp: (WebCore::RenderLayer::paint): Pass an OverlapTestRequestMap to paintLayer(). When done painting, inform any remaining requestClients that they are not overlapped.

(WebCore::RenderLayer::paintLayer): Take an OverlapTestRequestMap and
pass it down to child and reflection layers. Inform requestClients if this
layer overlaps their requested rects.

  • rendering/RenderLayer.h:
  • rendering/RenderObject.h: (WebCore::RenderObject::PaintInfo::PaintInfo): Added an OverlapTestRequestMap member.
  • rendering/RenderReplica.cpp: (WebCore::RenderReplica::paint): For now, pass a 0 OverlapTestRequestMap to paintLayer().
  • rendering/RenderWidget.cpp: (WebCore::RenderWidget::paint): For FrameViews, request an overlap test with the frame. (WebCore::RenderWidget::setOverlapTestResult): Call FrameView::setIsOverlapped() with the result of the overlap test.
  • rendering/RenderWidget.h: Made RenderWidget an OverlapTestRequestClient.
Location:
trunk/WebCore
Files:
1 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r42846 r42849  
     12009-04-24  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Dave Hyatt.
     4
     5        - fix https://bugs.webkit.org/show_bug.cgi?id=5909
     6          <rdar://problem/5863349> overlapping element leaves trail when
     7          scrolling iframe
     8
     9        * WebCore.xcodeproj/project.pbxproj: Added OverlapTestRequestClient.h.
     10
     11        * page/FrameView.cpp:
     12        (WebCore::FrameView::reset): Initialize m_isOverlapped.
     13        (WebCore::FrameView::useSlowRepaints): Also check m_isOverlapped.
     14        (WebCore::FrameView::removeSlowRepaintObject): Use useSlowRepaints()
     15        so overlapping is taken into account.
     16        (WebCore::FrameView::setIsOverlapped): Added. Sets m_isOverlapped and
     17        enables or disables copy-on-scroll accordingly.
     18
     19        * page/FrameView.h:
     20        Added setIsOverlapped() and m_isOverlapped.
     21
     22        * rendering/OverlapTestRequestClient.h: Added. During foreground painting,
     23        an OverlapTestRequestClient can make a request to test if any subsequently-
     24        painted layers overlap a rect. The test result is delivered to the
     25        requestClient via setOverlapTestResult().
     26        (WebCore::OverlapTestRequestClient::~OverlapTestRequestClient):
     27
     28        * rendering/RenderLayer.cpp:
     29        (WebCore::RenderLayer::paint): Pass an OverlapTestRequestMap to
     30        paintLayer(). When done painting, inform any remaining requestClients that
     31        they are not overlapped.
     32
     33        (WebCore::RenderLayer::paintLayer): Take an OverlapTestRequestMap and
     34        pass it down to child and reflection layers. Inform requestClients if this
     35        layer overlaps their requested rects.
     36
     37        * rendering/RenderLayer.h:
     38
     39        * rendering/RenderObject.h:
     40        (WebCore::RenderObject::PaintInfo::PaintInfo): Added an
     41        OverlapTestRequestMap member.
     42
     43        * rendering/RenderReplica.cpp:
     44        (WebCore::RenderReplica::paint): For now, pass a 0 OverlapTestRequestMap
     45        to paintLayer().
     46
     47        * rendering/RenderWidget.cpp:
     48        (WebCore::RenderWidget::paint): For FrameViews, request an overlap test
     49        with the frame.
     50        (WebCore::RenderWidget::setOverlapTestResult): Call
     51        FrameView::setIsOverlapped() with the result of the overlap test.
     52
     53        * rendering/RenderWidget.h: Made RenderWidget an OverlapTestRequestClient.
     54
    1552009-04-24  David Hyatt  <hyatt@apple.com>
    256
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r42846 r42849  
    611611                3724CA7E0E68B20500DB4384 /* FontMacCoreText.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3724CA7D0E68B20500DB4384 /* FontMacCoreText.cpp */; };
    612612                3744570F0DB05FA500AE0992 /* SVGGlyphMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 3744570E0DB05FA500AE0992 /* SVGGlyphMap.h */; };
     613                3774ABA50FA21EB400AD7DE9 /* OverlapTestRequestClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 3774ABA30FA21EB400AD7DE9 /* OverlapTestRequestClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
    613614                3784C34B0E11AA34007D8D48 /* FontTraitsMask.h in Headers */ = {isa = PBXBuildFile; fileRef = 3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */; settings = {ATTRIBUTES = (Private, ); }; };
    614615                37919C230B7D188600A56998 /* PositionIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 37919C210B7D188600A56998 /* PositionIterator.cpp */; };
     
    55255526                3724CA7D0E68B20500DB4384 /* FontMacCoreText.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontMacCoreText.cpp; sourceTree = "<group>"; };
    55265527                3744570E0DB05FA500AE0992 /* SVGGlyphMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGGlyphMap.h; sourceTree = "<group>"; };
     5528                3774ABA30FA21EB400AD7DE9 /* OverlapTestRequestClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OverlapTestRequestClient.h; sourceTree = "<group>"; };
    55275529                3784C34A0E11AA34007D8D48 /* FontTraitsMask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FontTraitsMask.h; sourceTree = "<group>"; };
    55285530                37919C210B7D188600A56998 /* PositionIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PositionIterator.cpp; sourceTree = "<group>"; };
     
    1435414356                                A8F5C0B60F9285AC0098E06B /* RenderSVGModelObject.h */,
    1435514357                                A8F5C0B70F9285AC0098E06B /* RenderSVGModelObject.cpp */,
     14358                                3774ABA30FA21EB400AD7DE9 /* OverlapTestRequestClient.h */,
    1435614359                        );
    1435714360                        path = rendering;
     
    1684816851                                93B2D8160F9920D2006AE6B2 /* SuddenTermination.h in Headers */,
    1684916852                                5D15E3AC0F9E6AC1009E0E3F /* XMLTokenizerScope.h in Headers */,
     16853                                3774ABA50FA21EB400AD7DE9 /* OverlapTestRequestClient.h in Headers */,
    1685016854                        );
    1685116855                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/page/FrameView.cpp

    r42592 r42849  
    168168{
    169169    m_useSlowRepaints = false;
     170    m_isOverlapped = false;
    170171    m_borderX = 30;
    171172    m_borderY = 30;
     
    672673bool FrameView::useSlowRepaints() const
    673674{
    674     return m_useSlowRepaints || m_slowRepaintObjectCount > 0;
     675    return m_useSlowRepaints || m_slowRepaintObjectCount > 0 || m_isOverlapped;
    675676}
    676677
     
    693694    m_slowRepaintObjectCount--;
    694695    if (!m_slowRepaintObjectCount)
    695         setCanBlitOnScroll(!m_useSlowRepaints);
     696        setCanBlitOnScroll(!useSlowRepaints());
     697}
     698
     699void FrameView::setIsOverlapped(bool isOverlapped)
     700{
     701    if (isOverlapped == m_isOverlapped)
     702        return;
     703
     704    m_isOverlapped = isOverlapped;
     705    setCanBlitOnScroll(!useSlowRepaints());
    696706}
    697707
  • trunk/WebCore/page/FrameView.h

    r42464 r42849  
    144144
    145145    void setUseSlowRepaints();
     146    void setIsOverlapped(bool);
    146147
    147148    void addSlowRepaintObject();
     
    194195    virtual bool isFrameView() const;
    195196
     197    friend class RenderWidget;
    196198    bool useSlowRepaints() const;
    197199
     
    231233    ScrollbarMode m_hmode;
    232234    bool m_useSlowRepaints;
     235    bool m_isOverlapped;
    233236    unsigned m_slowRepaintObjectCount;
    234237
  • trunk/WebCore/rendering/RenderLayer.cpp

    r42291 r42849  
    6464#include "HitTestResult.h"
    6565#include "OverflowEvent.h"
     66#include "OverlapTestRequestClient.h"
    6667#include "Page.h"
    6768#include "PlatformMouseEvent.h"
     
    18871888}
    18881889
    1889 void
    1890 RenderLayer::paint(GraphicsContext* p, const IntRect& damageRect, PaintRestriction paintRestriction, RenderObject *paintingRoot)
    1891 {
    1892     paintLayer(this, p, damageRect, false, paintRestriction, paintingRoot);
     1890void RenderLayer::paint(GraphicsContext* p, const IntRect& damageRect, PaintRestriction paintRestriction, RenderObject *paintingRoot)
     1891{
     1892    RenderObject::OverlapTestRequestMap overlapTestRequests;
     1893    paintLayer(this, p, damageRect, false, paintRestriction, paintingRoot, &overlapTestRequests);
     1894    RenderObject::OverlapTestRequestMap::iterator end = overlapTestRequests.end();
     1895    for (RenderObject::OverlapTestRequestMap::iterator it = overlapTestRequests.begin(); it != end; ++it)
     1896        it->first->setOverlapTestResult(false);
    18931897}
    18941898
     
    19111915RenderLayer::paintLayer(RenderLayer* rootLayer, GraphicsContext* p,
    19121916                        const IntRect& paintDirtyRect, bool haveTransparency, PaintRestriction paintRestriction,
    1913                         RenderObject* paintingRoot, bool appliedTransform, bool temporaryClipRects)
     1917                        RenderObject* paintingRoot, RenderObject::OverlapTestRequestMap* overlapTestRequests,
     1918                        bool appliedTransform, bool temporaryClipRects)
    19141919{
    19151920#if USE(ACCELERATED_COMPOSITING)
     
    19691974
    19701975        // Now do a paint with the root layer shifted to be us.
    1971         paintLayer(this, p, transform.inverse().mapRect(paintDirtyRect), haveTransparency, paintRestriction, paintingRoot, true, temporaryClipRects);
     1976        paintLayer(this, p, transform.inverse().mapRect(paintDirtyRect), haveTransparency, paintRestriction, paintingRoot, overlapTestRequests, true, temporaryClipRects);
    19721977
    19731978        p->restore();
     
    19831988        // Mark that we are now inside replica painting.
    19841989        m_paintingInsideReflection = true;
    1985         reflectionLayer()->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, false, temporaryClipRects);
     1990        reflectionLayer()->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, overlapTestRequests, false, temporaryClipRects);
    19861991        m_paintingInsideReflection = false;
    19871992    }
     
    20092014        paintingRootForRenderer = paintingRoot;
    20102015
     2016    if (overlapTestRequests) {
     2017         Vector<OverlapTestRequestClient*> overlappedRequestClients;
     2018        RenderObject::OverlapTestRequestMap::iterator end = overlapTestRequests->end();
     2019        for (RenderObject::OverlapTestRequestMap::iterator it = overlapTestRequests->begin(); it != end; ++it) {
     2020            if (!layerBounds.intersects(it->second))
     2021                continue;
     2022
     2023            it->first->setOverlapTestResult(true);
     2024            overlappedRequestClients.append(it->first);
     2025        }
     2026        for (size_t i = 0; i < overlappedRequestClients.size(); ++i)
     2027            overlapTestRequests->remove(overlappedRequestClients[i]);
     2028    }
     2029
    20112030    // We want to paint our layer, but only if we intersect the damage rect.
    20122031    bool shouldPaint = intersectsDamageRect(layerBounds, damageRect, rootLayer) && m_hasVisibleContent;
     
    20312050    if (m_negZOrderList)
    20322051        for (Vector<RenderLayer*>::iterator it = m_negZOrderList->begin(); it != m_negZOrderList->end(); ++it)
    2033             it[0]->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, false, temporaryClipRects);
     2052            it[0]->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, overlapTestRequests, false, temporaryClipRects);
    20342053   
    20352054    // Now establish the appropriate clip and paint our child RenderObjects.
     
    20492068            renderer()->paint(paintInfo, tx, ty);
    20502069            paintInfo.phase = PaintPhaseForeground;
     2070            paintInfo.overlapTestRequests = overlapTestRequests;
    20512071            renderer()->paint(paintInfo, tx, ty);
    20522072            paintInfo.phase = PaintPhaseChildOutlines;
     
    20702090        for (Vector<RenderLayer*>::iterator it = m_normalFlowList->begin(); it != m_normalFlowList->end(); ++it) {
    20712091            if (it[0]->isSelfPaintingLayer())
    2072                 it[0]->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, false, temporaryClipRects);
     2092                it[0]->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, overlapTestRequests, false, temporaryClipRects);
    20732093        }
    20742094
     
    20762096    if (m_posZOrderList)
    20772097        for (Vector<RenderLayer*>::iterator it = m_posZOrderList->begin(); it != m_posZOrderList->end(); ++it)
    2078             it[0]->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, false, temporaryClipRects);
     2098            it[0]->paintLayer(rootLayer, p, paintDirtyRect, haveTransparency, paintRestriction, paintingRoot, overlapTestRequests, false, temporaryClipRects);
    20792099   
    20802100    if (renderer()->hasMask() && shouldPaint && !selectionOnly && !damageRect.isEmpty()) {
  • trunk/WebCore/rendering/RenderLayer.h

    r42291 r42849  
    442442    void paintLayer(RenderLayer* rootLayer, GraphicsContext*, const IntRect& paintDirtyRect,
    443443                    bool haveTransparency, PaintRestriction, RenderObject* paintingRoot,
     444                    RenderObject::OverlapTestRequestMap* = 0,
    444445                    bool appliedTransform = false, bool temporaryClipRects = false);
    445446
  • trunk/WebCore/rendering/RenderObject.h

    r42840 r42849  
    4242class InlineBox;
    4343class InlineFlowBox;
     44class OverlapTestRequestClient;
    4445class Position;
    4546class RenderBoxModelObject;
     
    434435    virtual int baselinePosition(bool firstLine, bool isRootLineBox = false) const;
    435436
     437    typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap;
     438
    436439    /*
    437440     * Paint the object and its children, clipped by (x|y|w|h).
     
    440443    struct PaintInfo {
    441444        PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, bool newForceBlackText,
    442                   RenderObject* newPaintingRoot, ListHashSet<RenderInline*>* newOutlineObjects)
     445                  RenderObject* newPaintingRoot, ListHashSet<RenderInline*>* newOutlineObjects,
     446                  OverlapTestRequestMap* overlapTestRequests = 0)
    443447            : context(newContext)
    444448            , rect(newRect)
     
    447451            , paintingRoot(newPaintingRoot)
    448452            , outlineObjects(newOutlineObjects)
     453            , overlapTestRequests(overlapTestRequests)
    449454        {
    450455        }
     
    456461        RenderObject* paintingRoot; // used to draw just one element and its visual kids
    457462        ListHashSet<RenderInline*>* outlineObjects; // used to list outlines that should be painted by a block with inline children
     463        OverlapTestRequestMap* overlapTestRequests;
    458464    };
    459465
  • trunk/WebCore/rendering/RenderReplica.cpp

    r40318 r42849  
    7373        layer()->parent()->paintLayer(layer()->transform() ? layer()->parent() : layer()->enclosingTransformedAncestor(),
    7474                                      paintInfo.context, paintInfo.rect,
    75                                       true, PaintRestrictionNone, 0,
     75                                      true, PaintRestrictionNone, 0, 0,
    7676                                      true,     // appliedTransform
    7777                                      true);    // temporaryClipRects
  • trunk/WebCore/rendering/RenderWidget.cpp

    r41945 r42849  
    212212        // to paint itself.  That way it will composite properly with z-indexed layers.
    213213        m_widget->paint(paintInfo.context, paintInfo.rect);
     214
     215        if (m_widget->isFrameView() && paintInfo.overlapTestRequests && !static_cast<FrameView*>(m_widget)->useSlowRepaints()) {
     216            ASSERT(!paintInfo.overlapTestRequests->contains(this));
     217            paintInfo.overlapTestRequests->set(this, m_widget->frameRect());
     218        }
    214219    }
    215220
     
    222227        paintInfo.context->fillRect(selectionRect(), selectionBackgroundColor());
    223228    }
     229}
     230
     231void RenderWidget::setOverlapTestResult(bool isOverlapped)
     232{
     233    ASSERT(m_widget);
     234    ASSERT(m_widget->isFrameView());
     235    static_cast<FrameView*>(m_widget)->setIsOverlapped(isOverlapped);
    224236}
    225237
  • trunk/WebCore/rendering/RenderWidget.h

    r40987 r42849  
    2525#define RenderWidget_h
    2626
     27#include "OverlapTestRequestClient.h"
    2728#include "RenderReplaced.h"
    2829
     
    3132class Widget;
    3233
    33 class RenderWidget : public RenderReplaced {
     34class RenderWidget : public RenderReplaced, private OverlapTestRequestClient {
    3435public:
    3536    RenderWidget(Node*);
     
    6566    virtual void deleteWidget();
    6667
     68    // OverlapTestRequestClient
     69    virtual void setOverlapTestResult(bool);
     70
    6771protected:
    6872    Widget* m_widget;
Note: See TracChangeset for help on using the changeset viewer.