Changeset 40564 in webkit


Ignore:
Timestamp:
Feb 3, 2009 6:41:38 PM (15 years ago)
Author:
Simon Fraser
Message:

2009-02-03 Simon Fraser <Simon Fraser>

Reviewed by Dave Hyatt

https://bugs.webkit.org/show_bug.cgi?id=23628

Fix selection repainting to do container-relative repaints. RenderView now
repaints the seleciton using the containerForRepaint() for each RenderSelectionInfo.
selectionRect() is now a wrapper for selectionRectForRepaint() with no container.

Pull SelectionInfo out of RenderObject.h, and BlockSelectionInfo out
of RenderBlock.h and move them into RenderSelectionInfo.h, with some
sharing and refactoring.

RenderBlock::selectionGapRectsForRepaint() is not yet container-aware.

Location:
trunk/WebCore
Files:
1 added
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r40563 r40564  
     12009-02-03  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Reviewed by Dave Hyatt
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=23628
     6
     7        Fix selection repainting to do container-relative repaints. RenderView now
     8        repaints the seleciton using the containerForRepaint() for each RenderSelectionInfo.
     9        selectionRect() is now a wrapper for selectionRectForRepaint() with no container.
     10       
     11        Pull SelectionInfo out of RenderObject.h, and BlockSelectionInfo out
     12        of RenderBlock.h and move them into RenderSelectionInfo.h, with some
     13        sharing and refactoring.
     14       
     15        RenderBlock::selectionGapRectsForRepaint() is not yet container-aware.
     16
     17        * GNUmakefile.am:
     18        * WebCore.vcproj/WebCore.vcproj:
     19        * WebCore.xcodeproj/project.pbxproj:
     20        * rendering/RenderBR.h:
     21        (WebCore::RenderBR::selectionRectForRepaint):
     22        * rendering/RenderBlock.cpp:
     23        (WebCore::RenderBlock::selectionGapRectsForRepaint):
     24        * rendering/RenderBlock.h:
     25        (WebCore::RenderBlock::selectionRectForRepaint):
     26        * rendering/RenderListMarker.cpp:
     27        (WebCore::RenderListMarker::paint):
     28        (WebCore::RenderListMarker::selectionRectForRepaint):
     29        * rendering/RenderListMarker.h:
     30        * rendering/RenderObject.h:
     31        (WebCore::RenderObject::selectionRect):
     32        (WebCore::RenderObject::selectionRectForRepaint):
     33        * rendering/RenderReplaced.cpp:
     34        (WebCore::RenderReplaced::selectionRectForRepaint):
     35        * rendering/RenderReplaced.h:
     36        * rendering/RenderSVGInlineText.cpp:
     37        (WebCore::RenderSVGInlineText::absoluteRects):
     38        (WebCore::RenderSVGInlineText::absoluteQuads):
     39        (WebCore::RenderSVGInlineText::selectionRectForRepaint):
     40        (WebCore::RenderSVGInlineText::computeRepaintRectForRange):
     41        * rendering/RenderSVGInlineText.h:
     42        * rendering/RenderSelectionInfo.h: Added.
     43        (WebCore::RenderSelectionInfoBase::RenderSelectionInfoBase):
     44        (WebCore::RenderSelectionInfoBase::object):
     45        (WebCore::RenderSelectionInfoBase::repaintContainer):
     46        (WebCore::RenderSelectionInfoBase::state):
     47        (WebCore::RenderSelectionInfo::RenderSelectionInfo):
     48        (WebCore::RenderSelectionInfo::repaint):
     49        (WebCore::RenderSelectionInfo::rect):
     50        (WebCore::RenderBlockSelectionInfo::RenderBlockSelectionInfo):
     51        (WebCore::RenderBlockSelectionInfo::repaint):
     52        (WebCore::RenderBlockSelectionInfo::block):
     53        (WebCore::RenderBlockSelectionInfo::rects):
     54        * rendering/RenderText.cpp:
     55        (WebCore::RenderText::selectionRectForRepaint):
     56        * rendering/RenderText.h:
     57        * rendering/RenderView.cpp:
     58        (WebCore::RenderView::selectionBounds):
     59        (WebCore::RenderView::setSelection):
     60        * rendering/RenderView.h:
     61        * rendering/RenderWidget.cpp:
     62        (WebCore::RenderWidget::paint):
     63
    1642009-02-03  David Hyatt  <hyatt@apple.com>
    265
  • trunk/WebCore/GNUmakefile.am

    r40535 r40564  
    15801580        WebCore/rendering/RenderScrollbarTheme.cpp \
    15811581        WebCore/rendering/RenderScrollbarTheme.h \
     1582        WebCore/rendering/RenderSelectionInfo.h \
    15821583        WebCore/rendering/RenderSlider.cpp \
    15831584        WebCore/rendering/RenderSlider.h \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r40531 r40564  
    95079507                        </File>
    95089508                        <File
     9509                                RelativePath="..\rendering\RenderSelectionInfo.h"
     9510                                >
     9511                        </File>
     9512                        <File
    95099513                                RelativePath="..\rendering\RenderSlider.cpp"
    95109514                                >
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r40527 r40564  
    145145                0BB4DBE20F2EE29800354619 /* CrossThreadCopier.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0BB4DBE10F2EE29800354619 /* CrossThreadCopier.cpp */; };
    146146                0BE030A20F3112FB003C1A46 /* RenderLineBoxList.h in Headers */ = {isa = PBXBuildFile; fileRef = 0BE030A10F3112FB003C1A46 /* RenderLineBoxList.h */; settings = {ATTRIBUTES = (Private, ); }; };
     147                0F11A54F0F39233100C37884 /* RenderSelectionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F11A54E0F39233100C37884 /* RenderSelectionInfo.h */; };
    147148                0F56028F0E4B76580065B038 /* RenderMarquee.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F56028D0E4B76580065B038 /* RenderMarquee.h */; };
    148149                0F5602900E4B76580065B038 /* RenderMarquee.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F56028E0E4B76580065B038 /* RenderMarquee.cpp */; };
     
    50095010                0BB4DBE10F2EE29800354619 /* CrossThreadCopier.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CrossThreadCopier.cpp; sourceTree = "<group>"; };
    50105011                0BE030A10F3112FB003C1A46 /* RenderLineBoxList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderLineBoxList.h; sourceTree = "<group>"; };
     5012                0F11A54E0F39233100C37884 /* RenderSelectionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderSelectionInfo.h; sourceTree = "<group>"; };
    50115013                0F56028D0E4B76580065B038 /* RenderMarquee.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderMarquee.h; sourceTree = "<group>"; };
    50125014                0F56028E0E4B76580065B038 /* RenderMarquee.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderMarquee.cpp; sourceTree = "<group>"; };
     
    1416014162                                BCA846D40DC67A350026C309 /* RenderReplica.cpp */,
    1416114163                                BCA846D50DC67A350026C309 /* RenderReplica.h */,
     14164                                0F11A54E0F39233100C37884 /* RenderSelectionInfo.h */,
    1416214165                                A7352C170B1BB89D00A986D0 /* RenderSVGBlock.cpp */,
    1416314166                                A7352C180B1BB89D00A986D0 /* RenderSVGBlock.h */,
     
    1672716730                                1A569D250D7E2B82007C3983 /* runtime_root.h in Headers */,
    1672816731                                93309E1E099E64920056E581 /* visible_units.h in Headers */,
     16732                                0F11A54F0F39233100C37884 /* RenderSelectionInfo.h in Headers */,
    1672916733                        );
    1673016734                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/rendering/RenderBR.h

    r37464 r40564  
    4141    virtual const char* renderName() const { return "RenderBR"; }
    4242 
    43     virtual IntRect selectionRect(bool) { return IntRect(); }
     43    virtual IntRect selectionRectForRepaint(RenderBox* /*repaintContainer*/, bool /*clipToVisibleContent*/) { return IntRect(); }
    4444
    4545    virtual unsigned width(unsigned /*from*/, unsigned /*len*/, const Font&, int /*xpos*/) const { return 0; }
  • trunk/WebCore/rendering/RenderBlock.cpp

    r40524 r40564  
    19631963}
    19641964
    1965 GapRects RenderBlock::selectionGapRects()
     1965GapRects RenderBlock::selectionGapRectsForRepaint(RenderBox* /*repaintContainer*/)
    19661966{
    19671967    ASSERT(!needsLayout());
     
    19701970        return GapRects();
    19711971
    1972     // FIXME: this is broken with transforms
     1972    // FIXME: this is broken with transforms and a non-null repaintContainer
    19731973    FloatPoint absContentPoint = localToAbsolute(FloatPoint());
    19741974    if (hasOverflowClip())
  • trunk/WebCore/rendering/RenderBlock.h

    r40518 r40564  
    263263    virtual void setSelectionState(SelectionState s);
    264264
    265     struct BlockSelectionInfo {
    266         RenderBlock* m_block;
    267         GapRects m_rects;
    268         SelectionState m_state;
    269 
    270         BlockSelectionInfo()
    271             : m_block(0)
    272             , m_state(SelectionNone)
    273         {
    274         }
    275 
    276         BlockSelectionInfo(RenderBlock* b)
    277             : m_block(b)
    278             , m_rects(b->needsLayout() ? GapRects() : b->selectionGapRects())
    279             , m_state(b->selectionState())
    280         {
    281         }
    282 
    283         RenderBlock* block() const { return m_block; }
    284         GapRects rects() const { return m_rects; }
    285         SelectionState state() const { return m_state; }
    286     };
    287 
    288     virtual IntRect selectionRect(bool) { return selectionGapRects(); }
    289     GapRects selectionGapRects();
     265    virtual IntRect selectionRectForRepaint(RenderBox* repaintContainer, bool /*clipToVisibleContent*/)
     266    {
     267        return selectionGapRectsForRepaint(repaintContainer);
     268    }
     269    GapRects selectionGapRectsForRepaint(RenderBox* repaintContainer);
    290270    virtual bool shouldPaintSelectionGaps() const;
    291271    bool isSelectionRoot() const;
  • trunk/WebCore/rendering/RenderListMarker.cpp

    r40312 r40564  
    546546#endif
    547547        context->drawImage(m_image->image(this, marker.size()), marker.location());
    548         if (selectionState() != SelectionNone)
     548        if (selectionState() != SelectionNone) {
     549            // FIXME: selectionRect() is in absolute, not painting coordinates.
    549550            context->fillRect(selectionRect(), selectionBackgroundColor());
     551        }
    550552        return;
    551553    }
     
    557559#endif
    558560
    559     if (selectionState() != SelectionNone)
     561    if (selectionState() != SelectionNone) {
     562        // FIXME: selectionRect() is in absolute, not painting coordinates.
    560563        context->fillRect(selectionRect(), selectionBackgroundColor());
     564    }
    561565
    562566    const Color color(style()->color());
     
    881885}
    882886
    883 IntRect RenderListMarker::selectionRect(bool clipToVisibleContent)
     887IntRect RenderListMarker::selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent)
    884888{
    885889    ASSERT(!needsLayout());
     
    892896           
    893897    if (clipToVisibleContent)
    894         computeAbsoluteRepaintRect(rect);
    895     else {
    896         FloatPoint absPos = localToAbsolute();
    897         rect.move(absPos.x(), absPos.y());
    898     }
     898        computeRectForRepaint(repaintContainer, rect);
     899    else
     900        rect = localToContainerQuad(FloatRect(rect), repaintContainer).enclosingBoundingBox();
    899901   
    900902    return rect;
  • trunk/WebCore/rendering/RenderListMarker.h

    r40312 r40564  
    6262
    6363    virtual void setSelectionState(SelectionState);
    64     virtual IntRect selectionRect(bool clipToVisibleContent = true);
     64    virtual IntRect selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent = true);
    6565    virtual bool canBeSelectionLeaf() const { return true; }
    6666
  • trunk/WebCore/rendering/RenderObject.h

    r40547 r40564  
    660660    // A single rectangle that encompasses all of the selected objects within this object.  Used to determine the tightest
    661661    // possible bounding box for the selection.
    662     virtual IntRect selectionRect(bool) { return IntRect(); }
     662    IntRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(0, clipToVisibleContent); }
     663    virtual IntRect selectionRectForRepaint(RenderBox* /*repaintContainer*/, bool /*clipToVisibleContent*/ = true) { return IntRect(); }
    663664
    664665    // Whether or not an object can be part of the leaf elements of the selection.
     
    674675    // Whether or not a given block needs to paint selection gaps.
    675676    virtual bool shouldPaintSelectionGaps() const { return false; }
    676 
    677     // This struct is used when the selection changes to cache the old and new state of the selection for each RenderObject.
    678     struct SelectionInfo {
    679         SelectionInfo()
    680             : m_object(0)
    681             , m_state(SelectionNone)
    682         {
    683         }
    684 
    685         SelectionInfo(RenderObject* o, bool clipToVisibleContent)
    686             : m_object(o)
    687             , m_rect(o->needsLayout() ? IntRect() : o->selectionRect(clipToVisibleContent))
    688             , m_state(o->selectionState())
    689         {
    690         }
    691 
    692         RenderObject* object() const { return m_object; }
    693         IntRect rect() const { return m_rect; }
    694         SelectionState state() const { return m_state; }
    695 
    696         RenderObject* m_object;
    697         IntRect m_rect;
    698         SelectionState m_state;
    699     };
    700677
    701678    Node* draggableNode(bool dhtmlOK, bool uaOK, int x, int y, bool& dhtmlWillDrag) const;
  • trunk/WebCore/rendering/RenderReplaced.cpp

    r40312 r40564  
    235235}
    236236
    237 IntRect RenderReplaced::selectionRect(bool clipToVisibleContent)
     237IntRect RenderReplaced::selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent)
    238238{
    239239    ASSERT(!needsLayout());
     
    244244    IntRect rect = localSelectionRect();
    245245    if (clipToVisibleContent)
    246         computeAbsoluteRepaintRect(rect);
    247     else {
    248         FloatPoint absPos = localToAbsolute(FloatPoint());
    249         rect.move(absPos.x(), absPos.y());
    250     }
     246        computeRectForRepaint(repaintContainer, rect);
     247    else
     248        rect = localToContainerQuad(FloatRect(rect), repaintContainer).enclosingBoundingBox();
    251249   
    252250    return rect;
  • trunk/WebCore/rendering/RenderReplaced.h

    r40461 r40564  
    6363    virtual bool canBeSelectionLeaf() const { return true; }
    6464    virtual void setSelectionState(SelectionState);
    65     virtual IntRect selectionRect(bool clipToVisibleContent = true);
     65    virtual IntRect selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent = true);
    6666
    6767    bool isSelected() const;
  • trunk/WebCore/rendering/RenderSVGInlineText.cpp

    r40347 r40564  
    6969void RenderSVGInlineText::absoluteRects(Vector<IntRect>& rects, int, int, bool)
    7070{
    71     rects.append(computeAbsoluteRectForRange(0, textLength()));
     71    rects.append(computeRepaintRectForRange(0, 0, textLength()));
    7272}
    7373
    7474void RenderSVGInlineText::absoluteQuads(Vector<FloatQuad>& quads, bool)
    7575{
    76     quads.append(FloatRect(computeAbsoluteRectForRange(0, textLength())));
     76    quads.append(FloatRect(computeRepaintRectForRange(0, 0, textLength())));
    7777}
    7878
    79 IntRect RenderSVGInlineText::selectionRect(bool)
     79IntRect RenderSVGInlineText::selectionRectForRepaint(RenderBox* repaintContainer, bool /*clipToVisibleContent*/)
    8080{
    8181    ASSERT(!needsLayout());
    8282
    83     IntRect rect;
    8483    if (selectionState() == SelectionNone)
    85         return rect;
     84        return IntRect();
    8685
    8786    // Early exit if we're ie. a <text> within a <defs> section.
    8887    if (isChildOfHiddenContainer(this))
    89         return rect;
     88        return IntRect();
    9089
    9190    // Now calculate startPos and endPos for painting selection.
     
    105104
    106105    if (startPos == endPos)
    107         return rect;
     106        return IntRect();
    108107
    109     return computeAbsoluteRectForRange(startPos, endPos);
     108    return computeRepaintRectForRange(repaintContainer, startPos, endPos);
    110109}
    111110
    112 IntRect RenderSVGInlineText::computeAbsoluteRectForRange(int startPos, int endPos)
     111IntRect RenderSVGInlineText::computeRepaintRectForRange(RenderBox* /*repaintContainer*/, int startPos, int endPos)
    113112{
    114     IntRect rect;
    115 
    116113    RenderBlock* cb = containingBlock();
    117114    if (!cb || !cb->container())
    118         return rect;
     115        return IntRect();
    119116
    120117    RenderSVGRoot* root = findSVGRootObject(parent());
    121118    if (!root)
    122         return rect;
     119        return IntRect();
    123120
     121    IntRect rect;
    124122    for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
    125123        rect.unite(box->selectionRect(0, 0, startPos, endPos));
     
    134132    FloatRect fixedRect(narrowPrecisionToFloat(rect.x() + absPos.x() - htmlParentCtm.e()),
    135133                        narrowPrecisionToFloat(rect.y() + absPos.y() - htmlParentCtm.f()), rect.width(), rect.height());
    136     // FIXME: broken with CSS transforms
     134    // FIXME: broken with CSS transforms, and non-zero repaintContainer
    137135    return enclosingIntRect(absoluteTransform().mapRect(fixedRect));
    138136}
  • trunk/WebCore/rendering/RenderSVGInlineText.h

    r40180 r40564  
    4242
    4343    virtual bool requiresLayer() const { return false; }
    44     virtual IntRect selectionRect(bool clipToVisibleContent = true);
     44    virtual IntRect selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent = true);
    4545    virtual bool isSVGText() const { return true; }
    4646    virtual InlineTextBox* createInlineTextBox();
     
    5252
    5353private:
    54     IntRect computeAbsoluteRectForRange(int startPos, int endPos);
     54    IntRect computeRepaintRectForRange(RenderBox* repaintContainer, int startPos, int endPos);
    5555};
    5656
  • trunk/WebCore/rendering/RenderText.cpp

    r40547 r40564  
    10741074}
    10751075
    1076 IntRect RenderText::selectionRect(bool clipToVisibleContent)
     1076IntRect RenderText::selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent)
    10771077{
    10781078    ASSERT(!needsLayout());
    10791079
    1080     IntRect rect;
    10811080    if (selectionState() == SelectionNone)
    1082         return rect;
     1081        return IntRect();
    10831082    RenderBlock* cb =  containingBlock();
    10841083    if (!cb)
    1085         return rect;
     1084        return IntRect();
    10861085
    10871086    // Now calculate startPos and endPos for painting selection.
     
    11011100
    11021101    if (startPos == endPos)
    1103         return rect;
    1104 
     1102        return IntRect();
     1103
     1104    IntRect rect;
    11051105    for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox())
    11061106        rect.unite(box->selectionRect(0, 0, startPos, endPos));
    11071107
    11081108    if (clipToVisibleContent)
    1109         computeAbsoluteRepaintRect(rect);
     1109        computeRectForRepaint(repaintContainer, rect);
    11101110    else {
    11111111        if (cb->hasColumns())
    11121112            cb->adjustRectForColumns(rect);
    1113         // FIXME: This doesn't work correctly with transforms.
    1114         FloatPoint absPos = localToAbsolute();
    1115         rect.move(absPos.x(), absPos.y());
     1113
     1114        rect = localToContainerQuad(FloatRect(rect), repaintContainer).enclosingBoundingBox();
    11161115    }
    11171116
  • trunk/WebCore/rendering/RenderText.h

    r40547 r40564  
    9696    virtual bool canBeSelectionLeaf() const { return true; }
    9797    virtual void setSelectionState(SelectionState s);
    98     virtual IntRect selectionRect(bool clipToVisibleContent = true);
     98    virtual IntRect selectionRectForRepaint(RenderBox* repaintContainer, bool clipToVisibleContent = true);
    9999    virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
    100100
  • trunk/WebCore/rendering/RenderView.cpp

    r40543 r40564  
    3030#include "HitTestResult.h"
    3131#include "RenderLayer.h"
     32#include "RenderSelectionInfo.h"
    3233
    3334namespace WebCore {
     
    278279}
    279280
    280 IntRect RenderView::selectionRect(bool clipToVisibleContent)
    281 {
    282     // The virtual selectionRect() should never be called on the RenderView.
    283     // We assert because there used to be ambiguity between
    284     // RenderView::selectionRect(bool) and
    285     // virtual RenderObject::selectionRect(bool) const
    286     ASSERT_NOT_REACHED();
    287     return RenderBlock::selectionRect(clipToVisibleContent);
    288 }
    289 
    290281IntRect RenderView::selectionBounds(bool clipToVisibleContent) const
    291282{
    292283    document()->updateRendering();
    293284
    294     typedef HashMap<RenderObject*, SelectionInfo*> SelectionMap;
     285    typedef HashMap<RenderObject*, RenderSelectionInfo*> SelectionMap;
    295286    SelectionMap selectedObjects;
    296287
     
    300291        if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selectionEnd) && os->selectionState() != SelectionNone) {
    301292            // Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
    302             selectedObjects.set(os, new SelectionInfo(os, clipToVisibleContent));
     293            selectedObjects.set(os, new RenderSelectionInfo(os, clipToVisibleContent));
    303294            RenderBlock* cb = os->containingBlock();
    304295            while (cb && !cb->isRenderView()) {
    305                 SelectionInfo* blockInfo = selectedObjects.get(cb);
     296                RenderSelectionInfo* blockInfo = selectedObjects.get(cb);
    306297                if (blockInfo)
    307298                    break;
    308                 selectedObjects.set(cb, new SelectionInfo(cb, clipToVisibleContent));
     299                selectedObjects.set(cb, new RenderSelectionInfo(cb, clipToVisibleContent));
    309300                cb = cb->containingBlock();
    310301            }
     
    318309    SelectionMap::iterator end = selectedObjects.end();
    319310    for (SelectionMap::iterator i = selectedObjects.begin(); i != end; ++i) {
    320         SelectionInfo* info = i->second;
     311        RenderSelectionInfo* info = i->second;
    321312        selRect.unite(info->rect());
    322313        delete info;
     
    343334
    344335    // Objects each have a single selection rect to examine.
    345     typedef HashMap<RenderObject*, SelectionInfo*> SelectedObjectMap;
     336    typedef HashMap<RenderObject*, RenderSelectionInfo*> SelectedObjectMap;
    346337    SelectedObjectMap oldSelectedObjects;
    347338    SelectedObjectMap newSelectedObjects;
     
    350341    // In order to get the repaint rect right, we have to examine left, middle, and right rects individually, since otherwise
    351342    // the union of those rects might remain the same even when changes have occurred.
    352     typedef HashMap<RenderBlock*, BlockSelectionInfo*> SelectedBlockMap;
     343    typedef HashMap<RenderBlock*, RenderBlockSelectionInfo*> SelectedBlockMap;
    353344    SelectedBlockMap oldSelectedBlocks;
    354345    SelectedBlockMap newSelectedBlocks;
     
    359350        if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selectionEnd) && os->selectionState() != SelectionNone) {
    360351            // Blocks are responsible for painting line gaps and margin gaps.  They must be examined as well.
    361             oldSelectedObjects.set(os, new SelectionInfo(os, true));
     352            oldSelectedObjects.set(os, new RenderSelectionInfo(os, true));
    362353            RenderBlock* cb = os->containingBlock();
    363354            while (cb && !cb->isRenderView()) {
    364                 BlockSelectionInfo* blockInfo = oldSelectedBlocks.get(cb);
     355                RenderBlockSelectionInfo* blockInfo = oldSelectedBlocks.get(cb);
    365356                if (blockInfo)
    366357                    break;
    367                 oldSelectedBlocks.set(cb, new BlockSelectionInfo(cb));
     358                oldSelectedBlocks.set(cb, new RenderBlockSelectionInfo(cb));
    368359                cb = cb->containingBlock();
    369360            }
     
    408399    while (o && o != stop) {
    409400        if ((o->canBeSelectionLeaf() || o == start || o == end) && o->selectionState() != SelectionNone) {
    410             newSelectedObjects.set(o, new SelectionInfo(o, true));
     401            newSelectedObjects.set(o, new RenderSelectionInfo(o, true));
    411402            RenderBlock* cb = o->containingBlock();
    412403            while (cb && !cb->isRenderView()) {
    413                 BlockSelectionInfo* blockInfo = newSelectedBlocks.get(cb);
     404                RenderBlockSelectionInfo* blockInfo = newSelectedBlocks.get(cb);
    414405                if (blockInfo)
    415406                    break;
    416                 newSelectedBlocks.set(cb, new BlockSelectionInfo(cb));
     407                newSelectedBlocks.set(cb, new RenderBlockSelectionInfo(cb));
    417408                cb = cb->containingBlock();
    418409            }
     
    435426    for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObjectsEnd; ++i) {
    436427        RenderObject* obj = i->first;
    437         SelectionInfo* newInfo = newSelectedObjects.get(obj);
    438         SelectionInfo* oldInfo = i->second;
     428        RenderSelectionInfo* newInfo = newSelectedObjects.get(obj);
     429        RenderSelectionInfo* oldInfo = i->second;
    439430        if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() != newInfo->state() ||
    440431            (m_selectionStart == obj && oldStartPos != m_selectionStartPos) ||
    441432            (m_selectionEnd == obj && oldEndPos != m_selectionEndPos)) {
    442             repaintViewRectangle(oldInfo->rect());
     433            oldInfo->repaint();
    443434            if (newInfo) {
    444                 repaintViewRectangle(newInfo->rect());
     435                newInfo->repaint();
    445436                newSelectedObjects.remove(obj);
    446437                delete newInfo;
     
    453444    SelectedObjectMap::iterator newObjectsEnd = newSelectedObjects.end();
    454445    for (SelectedObjectMap::iterator i = newSelectedObjects.begin(); i != newObjectsEnd; ++i) {
    455         SelectionInfo* newInfo = i->second;
    456         repaintViewRectangle(newInfo->rect());
     446        RenderSelectionInfo* newInfo = i->second;
     447        newInfo->repaint();
    457448        delete newInfo;
    458449    }
     
    462453    for (SelectedBlockMap::iterator i = oldSelectedBlocks.begin(); i != oldBlocksEnd; ++i) {
    463454        RenderBlock* block = i->first;
    464         BlockSelectionInfo* newInfo = newSelectedBlocks.get(block);
    465         BlockSelectionInfo* oldInfo = i->second;
     455        RenderBlockSelectionInfo* newInfo = newSelectedBlocks.get(block);
     456        RenderBlockSelectionInfo* oldInfo = i->second;
    466457        if (!newInfo || oldInfo->rects() != newInfo->rects() || oldInfo->state() != newInfo->state()) {
    467             repaintViewRectangle(oldInfo->rects());
     458            oldInfo->repaint();
    468459            if (newInfo) {
    469                 repaintViewRectangle(newInfo->rects());
     460                newInfo->repaint();
    470461                newSelectedBlocks.remove(block);
    471462                delete newInfo;
     
    478469    SelectedBlockMap::iterator newBlocksEnd = newSelectedBlocks.end();
    479470    for (SelectedBlockMap::iterator i = newSelectedBlocks.begin(); i != newBlocksEnd; ++i) {
    480         BlockSelectionInfo* newInfo = i->second;
    481         repaintViewRectangle(newInfo->rects());
     471        RenderBlockSelectionInfo* newInfo = i->second;
     472        newInfo->repaint();
    482473        delete newInfo;
    483474    }
  • trunk/WebCore/rendering/RenderView.h

    r40543 r40564  
    152152protected:
    153153    virtual FloatQuad localToContainerQuad(const FloatQuad&, RenderBox* repaintContainer, bool fixed = false) const;
    154 
    155 private:
    156     // selectionRect should never be called on a RenderView
    157     virtual IntRect selectionRect(bool);
    158154
    159155protected:
  • trunk/WebCore/rendering/RenderWidget.cpp

    r40143 r40564  
    205205
    206206    // Paint a partially transparent wash over selected widgets.
    207     if (isSelected() && !document()->printing())
     207    if (isSelected() && !document()->printing()) {
     208        // FIXME: selectionRect() is in absolute, not painting coordinates.
    208209        paintInfo.context->fillRect(selectionRect(), selectionBackgroundColor());
     210    }
    209211}
    210212
Note: See TracChangeset for help on using the changeset viewer.