Changeset 71246 in webkit


Ignore:
Timestamp:
Nov 3, 2010 10:16:23 AM (13 years ago)
Author:
hyatt@apple.com
Message:

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

Reviewed by Dan Bernstein.

Rename all the selection gap functions to not be directionally specific. Left and Right turn into LogicalLeft and
LogicalRight. Horizontal becomes Line. Vertical becomes Block.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::selectionGapRectsForRepaint):
(WebCore::RenderBlock::paintSelection):
(WebCore::RenderBlock::fillSelectionGaps):
(WebCore::RenderBlock::fillInlineSelectionGaps):
(WebCore::RenderBlock::fillBlockSelectionGaps):
(WebCore::RenderBlock::fillLineSelectionGap):
(WebCore::RenderBlock::fillBlockSelectionGap):
(WebCore::RenderBlock::fillLogicalLeftSelectionGap):
(WebCore::RenderBlock::fillLogicalRightSelectionGap):
(WebCore::RenderBlock::getSelectionGapInfo):
(WebCore::RenderBlock::logicalLeftSelectionOffset):
(WebCore::RenderBlock::logicalRightSelectionOffset):

  • rendering/RenderBlock.h:
  • rendering/RootInlineBox.cpp:

(WebCore::RootInlineBox::fillLineSelectionGap):

Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r71244 r71246  
     12010-11-03  David Hyatt  <hyatt@apple.com>
     2
     3        Reviewed by Dan Bernstein.
     4
     5        https://bugs.webkit.org/show_bug.cgi?id=48928
     6       
     7        Rename all the selection gap functions to not be directionally specific.  Left and Right turn into LogicalLeft and
     8        LogicalRight.  Horizontal becomes Line.  Vertical becomes Block.
     9
     10        * rendering/RenderBlock.cpp:
     11        (WebCore::RenderBlock::selectionGapRectsForRepaint):
     12        (WebCore::RenderBlock::paintSelection):
     13        (WebCore::RenderBlock::fillSelectionGaps):
     14        (WebCore::RenderBlock::fillInlineSelectionGaps):
     15        (WebCore::RenderBlock::fillBlockSelectionGaps):
     16        (WebCore::RenderBlock::fillLineSelectionGap):
     17        (WebCore::RenderBlock::fillBlockSelectionGap):
     18        (WebCore::RenderBlock::fillLogicalLeftSelectionGap):
     19        (WebCore::RenderBlock::fillLogicalRightSelectionGap):
     20        (WebCore::RenderBlock::getSelectionGapInfo):
     21        (WebCore::RenderBlock::logicalLeftSelectionOffset):
     22        (WebCore::RenderBlock::logicalRightSelectionOffset):
     23        * rendering/RenderBlock.h:
     24        * rendering/RootInlineBox.cpp:
     25        (WebCore::RootInlineBox::fillLineSelectionGap):
     26
    1272010-11-03  Dimitri Glazkov  <dglazkov@chromium.org>
    228
  • trunk/WebCore/rendering/RenderBlock.cpp

    r71177 r71246  
    25552555
    25562556    int lastTop = 0;
    2557     int lastLeft = leftSelectionOffset(this, lastTop);
    2558     int lastRight = rightSelectionOffset(this, lastTop);
     2557    int lastLeft = logicalLeftSelectionOffset(this, lastTop);
     2558    int lastRight = logicalRightSelectionOffset(this, lastTop);
    25592559   
    25602560    return fillSelectionGaps(this, offsetFromRepaintContainer.x(), offsetFromRepaintContainer.y(), offsetFromRepaintContainer.x(), offsetFromRepaintContainer.y(), lastTop, lastLeft, lastRight);
     
    25652565    if (shouldPaintSelectionGaps() && paintInfo.phase == PaintPhaseForeground) {
    25662566        int lastTop = 0;
    2567         int lastLeft = leftSelectionOffset(this, lastTop);
    2568         int lastRight = rightSelectionOffset(this, lastTop);
     2567        int lastLeft = logicalLeftSelectionOffset(this, lastTop);
     2568        int lastRight = logicalRightSelectionOffset(this, lastTop);
    25692569        paintInfo.context->save();
    25702570        IntRect gapRectsBounds = fillSelectionGaps(this, tx, ty, tx, ty, lastTop, lastLeft, lastRight, &paintInfo);
     
    26302630        // FIXME: We should learn how to gap fill multiple columns and transforms eventually.
    26312631        lastTop = (ty - blockY) + height();
    2632         lastLeft = leftSelectionOffset(rootBlock, height());
    2633         lastRight = rightSelectionOffset(rootBlock, height());
     2632        lastLeft = logicalLeftSelectionOffset(rootBlock, height());
     2633        lastRight = logicalRightSelectionOffset(rootBlock, height());
    26342634        return result;
    26352635    }
     
    26422642    // Go ahead and fill the vertical gap all the way to the bottom of our block if the selection extends past our block.
    26432643    if (rootBlock == this && (selectionState() != SelectionBoth && selectionState() != SelectionEnd))
    2644         result.uniteCenter(fillVerticalSelectionGap(lastTop, lastLeft, lastRight, ty + height(),
    2645                                                     rootBlock, blockX, blockY, paintInfo));
     2644        result.uniteCenter(fillBlockSelectionGap(lastTop, lastLeft, lastRight, ty + height(),
     2645                                                 rootBlock, blockX, blockY, paintInfo));
    26462646    return result;
    26472647}
     
    26592659            // case.
    26602660            lastTop = (ty - blockY) + height();
    2661             lastLeft = leftSelectionOffset(rootBlock, height());
    2662             lastRight = rightSelectionOffset(rootBlock, height());
     2661            lastLeft = logicalLeftSelectionOffset(rootBlock, height());
     2662            lastRight = logicalRightSelectionOffset(rootBlock, height());
    26632663        }
    26642664        return result;
     
    26762676        if (!containsStart && !lastSelectedLine &&
    26772677            selectionState() != SelectionStart && selectionState() != SelectionBoth)
    2678             result.uniteCenter(fillVerticalSelectionGap(lastTop, lastLeft, lastRight, ty + selTop,
    2679                                                         rootBlock, blockX, blockY, paintInfo));
     2678            result.uniteCenter(fillBlockSelectionGap(lastTop, lastLeft, lastRight, ty + selTop,
     2679                                                     rootBlock, blockX, blockY, paintInfo));
    26802680
    26812681        if (!paintInfo || (ty + selTop < paintInfo->rect.bottom() && ty + selTop + selHeight > paintInfo->rect.y()))
     
    26922692        // Go ahead and update our lastY to be the bottom of the last selected line.
    26932693        lastTop = (ty - blockY) + lastSelectedLine->selectionBottom();
    2694         lastLeft = leftSelectionOffset(rootBlock, lastSelectedLine->selectionBottom());
    2695         lastRight = rightSelectionOffset(rootBlock, lastSelectedLine->selectionBottom());
     2694        lastLeft = logicalLeftSelectionOffset(rootBlock, lastSelectedLine->selectionBottom());
     2695        lastRight = logicalRightSelectionOffset(rootBlock, lastSelectedLine->selectionBottom());
    26962696    }
    26972697    return result;
     
    27292729            if (childState == SelectionEnd || childState == SelectionInside)
    27302730                // Fill the gap above the object.
    2731                 result.uniteCenter(fillVerticalSelectionGap(lastTop, lastLeft, lastRight,
    2732                                                             ty + curr->y(), rootBlock, blockX, blockY, paintInfo));
     2731                result.uniteCenter(fillBlockSelectionGap(lastTop, lastLeft, lastRight,
     2732                                                         ty + curr->y(), rootBlock, blockX, blockY, paintInfo));
    27332733
    27342734            // Only fill side gaps for objects that paint their own selection if we know for sure the selection is going to extend all the way *past*
     
    27392739            // Fill side gaps on this object based off its state.
    27402740            bool leftGap, rightGap;
    2741             getHorizontalSelectionGapInfo(childState, leftGap, rightGap);
     2741            getSelectionGapInfo(childState, leftGap, rightGap);
    27422742
    27432743            if (leftGap)
    2744                 result.uniteLeft(fillLeftSelectionGap(this, curr->x(), curr->y(), curr->height(), rootBlock, blockX, blockY, tx, ty, paintInfo));
     2744                result.uniteLeft(fillLogicalLeftSelectionGap(this, curr->x(), curr->y(), curr->height(), rootBlock, blockX, blockY, tx, ty, paintInfo));
    27452745            if (rightGap)
    2746                 result.uniteRight(fillRightSelectionGap(this, curr->x() + curr->width(), curr->y(), curr->height(), rootBlock, blockX, blockY, tx, ty, paintInfo));
     2746                result.uniteRight(fillLogicalRightSelectionGap(this, curr->x() + curr->width(), curr->y(), curr->height(), rootBlock, blockX, blockY, tx, ty, paintInfo));
    27472747
    27482748            // Update lastTop to be just underneath the object.  lastLeft and lastRight extend as far as
     
    27502750            // to the border of the root selection block.
    27512751            lastTop = (ty - blockY) + (curr->y() + curr->height());
    2752             lastLeft = leftSelectionOffset(rootBlock, curr->y() + curr->height());
    2753             lastRight = rightSelectionOffset(rootBlock, curr->y() + curr->height());
     2752            lastLeft = logicalLeftSelectionOffset(rootBlock, curr->y() + curr->height());
     2753            lastRight = logicalRightSelectionOffset(rootBlock, curr->y() + curr->height());
    27542754        } else if (childState != SelectionNone)
    27552755            // We must be a block that has some selected object inside it.  Go ahead and recur.
     
    27602760}
    27612761
    2762 IntRect RenderBlock::fillHorizontalSelectionGap(RenderObject* selObj, int xPos, int yPos, int width, int height, const PaintInfo* paintInfo)
     2762IntRect RenderBlock::fillLineSelectionGap(RenderObject* selObj, int xPos, int yPos, int width, int height, const PaintInfo* paintInfo)
    27632763{
    27642764    if (width <= 0 || height <= 0)
     
    27702770}
    27712771
    2772 IntRect RenderBlock::fillVerticalSelectionGap(int lastTop, int lastLeft, int lastRight, int bottomY, RenderBlock* rootBlock,
    2773                                               int blockX, int blockY, const PaintInfo* paintInfo)
     2772IntRect RenderBlock::fillBlockSelectionGap(int lastTop, int lastLeft, int lastRight, int bottomY, RenderBlock* rootBlock,
     2773                                           int blockX, int blockY, const PaintInfo* paintInfo)
    27742774{
    27752775    int top = blockY + lastTop;
     
    27792779
    27802780    // Get the selection offsets for the bottom of the gap
    2781     int left = blockX + max(lastLeft, leftSelectionOffset(rootBlock, bottomY));
    2782     int right = blockX + min(lastRight, rightSelectionOffset(rootBlock, bottomY));
     2781    int left = blockX + max(lastLeft, logicalLeftSelectionOffset(rootBlock, bottomY));
     2782    int right = blockX + min(lastRight, logicalRightSelectionOffset(rootBlock, bottomY));
    27832783    int width = right - left;
    27842784    if (width <= 0)
     
    27912791}
    27922792
    2793 IntRect RenderBlock::fillLeftSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
    2794                                           int blockX, int /*blockY*/, int tx, int ty, const PaintInfo* paintInfo)
     2793IntRect RenderBlock::fillLogicalLeftSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
     2794                                                 int blockX, int /*blockY*/, int tx, int ty, const PaintInfo* paintInfo)
    27952795{
    27962796    int top = yPos + ty;
    2797     int left = blockX + max(leftSelectionOffset(rootBlock, yPos), leftSelectionOffset(rootBlock, yPos + height));
    2798     int right = min(xPos + tx, blockX + min(rightSelectionOffset(rootBlock, yPos), rightSelectionOffset(rootBlock, yPos + height)));
     2797    int left = blockX + max(logicalLeftSelectionOffset(rootBlock, yPos), logicalLeftSelectionOffset(rootBlock, yPos + height));
     2798    int right = min(xPos + tx, blockX + min(logicalRightSelectionOffset(rootBlock, yPos), logicalRightSelectionOffset(rootBlock, yPos + height)));
    27992799    int width = right - left;
    28002800    if (width <= 0)
     
    28072807}
    28082808
    2809 IntRect RenderBlock::fillRightSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
    2810                                            int blockX, int /*blockY*/, int tx, int ty, const PaintInfo* paintInfo)
    2811 {
    2812     int left = max(xPos + tx, blockX + max(leftSelectionOffset(rootBlock, yPos), leftSelectionOffset(rootBlock, yPos + height)));
     2809IntRect RenderBlock::fillLogicalRightSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
     2810                                                  int blockX, int /*blockY*/, int tx, int ty, const PaintInfo* paintInfo)
     2811{
     2812    int left = max(xPos + tx, blockX + max(logicalLeftSelectionOffset(rootBlock, yPos), logicalLeftSelectionOffset(rootBlock, yPos + height)));
    28132813    int top = yPos + ty;
    2814     int right = blockX + min(rightSelectionOffset(rootBlock, yPos), rightSelectionOffset(rootBlock, yPos + height));
     2814    int right = blockX + min(logicalRightSelectionOffset(rootBlock, yPos), logicalRightSelectionOffset(rootBlock, yPos + height));
    28152815    int width = right - left;
    28162816    if (width <= 0)
     
    28232823}
    28242824
    2825 void RenderBlock::getHorizontalSelectionGapInfo(SelectionState state, bool& leftGap, bool& rightGap)
     2825void RenderBlock::getSelectionGapInfo(SelectionState state, bool& leftGap, bool& rightGap)
    28262826{
    28272827    bool ltr = style()->isLeftToRightDirection();
     
    28342834}
    28352835
    2836 int RenderBlock::leftSelectionOffset(RenderBlock* rootBlock, int yPos)
     2836int RenderBlock::logicalLeftSelectionOffset(RenderBlock* rootBlock, int yPos)
    28372837{
    28382838    int left = logicalLeftOffsetForLine(yPos, false);
     
    28402840        if (rootBlock != this)
    28412841            // The border can potentially be further extended by our containingBlock().
    2842             return containingBlock()->leftSelectionOffset(rootBlock, yPos + y());
     2842            return containingBlock()->logicalLeftSelectionOffset(rootBlock, yPos + y());
    28432843        return left;
    28442844    }
     
    28542854}
    28552855
    2856 int RenderBlock::rightSelectionOffset(RenderBlock* rootBlock, int yPos)
     2856int RenderBlock::logicalRightSelectionOffset(RenderBlock* rootBlock, int yPos)
    28572857{
    28582858    int right = logicalRightOffsetForLine(yPos, false);
     
    28602860        if (rootBlock != this)
    28612861            // The border can potentially be further extended by our containingBlock().
    2862             return containingBlock()->rightSelectionOffset(rootBlock, yPos + y());
     2862            return containingBlock()->logicalRightSelectionOffset(rootBlock, yPos + y());
    28632863        return right;
    28642864    }
  • trunk/WebCore/rendering/RenderBlock.h

    r70797 r71246  
    116116
    117117    GapRects selectionGapRectsForRepaint(RenderBoxModelObject* repaintContainer);
    118     IntRect fillLeftSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
    119                                  int blockX, int blockY, int tx, int ty, const PaintInfo*);
    120     IntRect fillRightSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
    121                                   int blockX, int blockY, int tx, int ty, const PaintInfo*);
    122     IntRect fillHorizontalSelectionGap(RenderObject* selObj, int xPos, int yPos, int width, int height, const PaintInfo*);
    123 
    124     void getHorizontalSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap);
     118    IntRect fillLogicalLeftSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
     119                                        int blockX, int blockY, int tx, int ty, const PaintInfo*);
     120    IntRect fillLogicalRightSelectionGap(RenderObject* selObj, int xPos, int yPos, int height, RenderBlock* rootBlock,
     121                                         int blockX, int blockY, int tx, int ty, const PaintInfo*);
     122    IntRect fillLineSelectionGap(RenderObject* selObj, int xPos, int yPos, int width, int height, const PaintInfo*);
     123
     124    void getSelectionGapInfo(SelectionState, bool& leftGap, bool& rightGap);
    125125
    126126    // Helper methods for computing line counts and heights for line counts.
     
    538538    GapRects fillBlockSelectionGaps(RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
    539539                                    int& lastTop, int& lastLeft, int& lastRight, const PaintInfo*);
    540     IntRect fillVerticalSelectionGap(int lastTop, int lastLeft, int lastRight, int bottomY, RenderBlock* rootBlock,
    541                                      int blockX, int blockY, const PaintInfo*);
    542     int leftSelectionOffset(RenderBlock* rootBlock, int y);
    543     int rightSelectionOffset(RenderBlock* rootBlock, int y);
     540    IntRect fillBlockSelectionGap(int lastTop, int lastLeft, int lastRight, int bottomY, RenderBlock* rootBlock,
     541                                  int blockX, int blockY, const PaintInfo*);
     542    int logicalLeftSelectionOffset(RenderBlock* rootBlock, int y);
     543    int logicalRightSelectionOffset(RenderBlock* rootBlock, int y);
    544544
    545545    virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
  • trunk/WebCore/rendering/RootInlineBox.cpp

    r71055 r71246  
    250250}
    251251
    252 GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty,
    253                                              const PaintInfo* paintInfo)
     252GapRects RootInlineBox::fillLineSelectionGap(int selTop, int selHeight, RenderBlock* rootBlock, int blockX, int blockY, int tx, int ty, const PaintInfo* paintInfo)
    254253{
    255254    RenderObject::SelectionState lineState = selectionState();
    256255
    257256    bool leftGap, rightGap;
    258     block()->getHorizontalSelectionGapInfo(lineState, leftGap, rightGap);
     257    block()->getSelectionGapInfo(lineState, leftGap, rightGap);
    259258
    260259    GapRects result;
     
    263262    InlineBox* lastBox = lastSelectedBox();
    264263    if (leftGap)
    265         result.uniteLeft(block()->fillLeftSelectionGap(firstBox->parent()->renderer(),
    266                                                        firstBox->x(), selTop, selHeight,
    267                                                        rootBlock, blockX, blockY, tx, ty, paintInfo));
     264        result.uniteLeft(block()->fillLogicalLeftSelectionGap(firstBox->parent()->renderer(),
     265                                                              firstBox->x(), selTop, selHeight,
     266                                                              rootBlock, blockX, blockY, tx, ty, paintInfo));
    268267    if (rightGap)
    269         result.uniteRight(block()->fillRightSelectionGap(lastBox->parent()->renderer(),
    270                                                          lastBox->x() + lastBox->logicalWidth(), selTop, selHeight,
    271                                                          rootBlock, blockX, blockY, tx, ty, paintInfo));
     268        result.uniteRight(block()->fillLogicalRightSelectionGap(lastBox->parent()->renderer(),
     269                                                                lastBox->x() + lastBox->logicalWidth(), selTop, selHeight,
     270                                                                rootBlock, blockX, blockY, tx, ty, paintInfo));
    272271
    273272    // When dealing with bidi text, a non-contiguous selection region is possible.
     
    285284            if (box->selectionState() != RenderObject::SelectionNone) {
    286285                if (isPreviousBoxSelected)  // VisibleSelection may be non-contiguous, see comment above.
    287                     result.uniteCenter(block()->fillHorizontalSelectionGap(box->parent()->renderer(),
    288                                                                            lastX + tx, selTop + ty,
    289                                                                            box->x() - lastX, selHeight, paintInfo));
     286                    result.uniteCenter(block()->fillLineSelectionGap(box->parent()->renderer(),
     287                                                                     lastX + tx, selTop + ty,
     288                                                                     box->x() - lastX, selHeight, paintInfo));
    290289                lastX = box->x() + box->logicalWidth();
    291290            }
Note: See TracChangeset for help on using the changeset viewer.