Changeset 90596 in webkit


Ignore:
Timestamp:
Jul 7, 2011 3:37:55 PM (13 years ago)
Author:
eae@chromium.org
Message:

Switch rendering tree selection code to to new layout types
https://bugs.webkit.org/show_bug.cgi?id=63762

Reviewed by Eric Seidel.

Switch selection getters and selection gap calculation methods over to
new layout abstraction.

No new tests, no functionality changes.

  • rendering/InlineTextBox.cpp:

(WebCore::InlineTextBox::selectionTop):
(WebCore::InlineTextBox::selectionBottom):
(WebCore::InlineTextBox::selectionHeight):
(WebCore::InlineTextBox::isSelected):

  • rendering/InlineTextBox.h:
  • rendering/RenderBR.h:

(WebCore::RenderBR::selectionRectForRepaint):

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::selectionGapRectsForRepaint):
(WebCore::RenderBlock::selectionGaps):
(WebCore::RenderBlock::inlineSelectionGaps):
(WebCore::RenderBlock::blockSelectionGaps):
(WebCore::RenderBlock::blockSelectionGap):
(WebCore::RenderBlock::logicalLeftSelectionGap):
(WebCore::RenderBlock::logicalRightSelectionGap):
(WebCore::RenderBlock::logicalLeftSelectionOffset):
(WebCore::RenderBlock::logicalRightSelectionOffset):
(WebCore::RenderBlock::positionForPointWithInlineChildren):
(WebCore::RenderBlock::desiredColumnWidth):

  • rendering/RenderBlock.h:

(WebCore::RenderBlock::selectionRectForRepaint):

  • rendering/RenderListMarker.cpp:

(WebCore::RenderListMarker::selectionRectForRepaint):

  • rendering/RenderListMarker.h:
  • rendering/RenderObject.h:

(WebCore::RenderObject::selectionRect):
(WebCore::RenderObject::selectionRectForRepaint):

  • rendering/RenderReplaced.cpp:

(WebCore::RenderReplaced::selectionRectForRepaint):

  • rendering/RenderReplaced.h:
  • rendering/RenderSelectionInfo.h:

(WebCore::RenderSelectionInfo::RenderSelectionInfo):

  • rendering/RenderText.cpp:

(WebCore::RenderText::selectionRectForRepaint):

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

(WebCore::RootInlineBox::selectionTop):
(WebCore::RootInlineBox::selectionBottom):

  • rendering/RootInlineBox.h:

(WebCore::RootInlineBox::selectionHeight):

Location:
trunk/Source/WebCore
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90595 r90596  
     12011-07-07  Emil A Eklund  <eae@chromium.org>
     2
     3        Switch rendering tree selection code to to new layout types
     4        https://bugs.webkit.org/show_bug.cgi?id=63762
     5
     6        Reviewed by Eric Seidel.
     7
     8        Switch selection getters and selection gap calculation methods over to
     9        new layout abstraction.
     10
     11        No new tests, no functionality changes.
     12
     13        * rendering/InlineTextBox.cpp:
     14        (WebCore::InlineTextBox::selectionTop):
     15        (WebCore::InlineTextBox::selectionBottom):
     16        (WebCore::InlineTextBox::selectionHeight):
     17        (WebCore::InlineTextBox::isSelected):
     18        * rendering/InlineTextBox.h:
     19        * rendering/RenderBR.h:
     20        (WebCore::RenderBR::selectionRectForRepaint):
     21        * rendering/RenderBlock.cpp:
     22        (WebCore::RenderBlock::selectionGapRectsForRepaint):
     23        (WebCore::RenderBlock::selectionGaps):
     24        (WebCore::RenderBlock::inlineSelectionGaps):
     25        (WebCore::RenderBlock::blockSelectionGaps):
     26        (WebCore::RenderBlock::blockSelectionGap):
     27        (WebCore::RenderBlock::logicalLeftSelectionGap):
     28        (WebCore::RenderBlock::logicalRightSelectionGap):
     29        (WebCore::RenderBlock::logicalLeftSelectionOffset):
     30        (WebCore::RenderBlock::logicalRightSelectionOffset):
     31        (WebCore::RenderBlock::positionForPointWithInlineChildren):
     32        (WebCore::RenderBlock::desiredColumnWidth):
     33        * rendering/RenderBlock.h:
     34        (WebCore::RenderBlock::selectionRectForRepaint):
     35        * rendering/RenderListMarker.cpp:
     36        (WebCore::RenderListMarker::selectionRectForRepaint):
     37        * rendering/RenderListMarker.h:
     38        * rendering/RenderObject.h:
     39        (WebCore::RenderObject::selectionRect):
     40        (WebCore::RenderObject::selectionRectForRepaint):
     41        * rendering/RenderReplaced.cpp:
     42        (WebCore::RenderReplaced::selectionRectForRepaint):
     43        * rendering/RenderReplaced.h:
     44        * rendering/RenderSelectionInfo.h:
     45        (WebCore::RenderSelectionInfo::RenderSelectionInfo):
     46        * rendering/RenderText.cpp:
     47        (WebCore::RenderText::selectionRectForRepaint):
     48        * rendering/RenderText.h:
     49        * rendering/RootInlineBox.cpp:
     50        (WebCore::RootInlineBox::selectionTop):
     51        (WebCore::RootInlineBox::selectionBottom):
     52        * rendering/RootInlineBox.h:
     53        (WebCore::RootInlineBox::selectionHeight):
     54
    1552011-07-07  Gavin Peters  <gavinp@chromium.org>
    256
  • trunk/Source/WebCore/rendering/InlineTextBox.cpp

    r90515 r90596  
    9999}
    100100
    101 int InlineTextBox::selectionTop()
     101LayoutUnit InlineTextBox::selectionTop()
    102102{
    103103    return root()->selectionTop();
    104104}
    105105
    106 int InlineTextBox::selectionBottom()
     106LayoutUnit InlineTextBox::selectionBottom()
    107107{
    108108    return root()->selectionBottom();
    109109}
    110110
    111 int InlineTextBox::selectionHeight()
     111LayoutUnit InlineTextBox::selectionHeight()
    112112{
    113113    return root()->selectionHeight();
     
    116116bool InlineTextBox::isSelected(int startPos, int endPos) const
    117117{
    118     int sPos = max(startPos - m_start, 0);
    119     int ePos = min(endPos - m_start, (int)m_len);
     118    LayoutUnit sPos = max<LayoutUnit>(startPos - m_start, 0);
     119    LayoutUnit ePos = min<LayoutUnit>(endPos - m_start, m_len);
    120120    return (sPos < ePos);
    121121}
  • trunk/Source/WebCore/rendering/InlineTextBox.h

    r90515 r90596  
    9696#endif
    9797private:
    98     int selectionTop();
    99     int selectionBottom();
    100     int selectionHeight();
     98    LayoutUnit selectionTop();
     99    LayoutUnit selectionBottom();
     100    LayoutUnit selectionHeight();
    101101
    102102    TextRun constructTextRun(RenderStyle*, const Font&, BufferForAppendingHyphen* = 0) const;
  • trunk/Source/WebCore/rendering/RenderBR.h

    r90250 r90596  
    3939    virtual const char* renderName() const { return "RenderBR"; }
    4040 
    41     virtual IntRect selectionRectForRepaint(RenderBoxModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/) { return IntRect(); }
     41    virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/) { return LayoutRect(); }
    4242
    4343    virtual float width(unsigned /*from*/, unsigned /*len*/, const Font&, float /*xPos*/, HashSet<const SimpleFontData*>* = 0 /*fallbackFonts*/ , GlyphOverflow* = 0) const { return 0; }
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r90590 r90596  
    27552755        offsetFromRepaintContainer -= layer()->scrolledContentOffset();
    27562756
    2757     int lastTop = 0;
    2758     int lastLeft = logicalLeftSelectionOffset(this, lastTop);
    2759     int lastRight = logicalRightSelectionOffset(this, lastTop);
     2757    LayoutUnit lastTop = 0;
     2758    LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop);
     2759    LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop);
    27602760   
    27612761    return selectionGaps(this, offsetFromRepaintContainer, IntSize(), lastTop, lastLeft, lastRight);
     
    28202820}
    28212821
    2822 GapRects RenderBlock::selectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
    2823                                     int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* paintInfo)
     2822GapRects RenderBlock::selectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     2823                                    LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* paintInfo)
    28242824{
    28252825    // IMPORTANT: Callers of this method that intend for painting to happen need to do a save/restore.
     
    28272827    if (paintInfo) {
    28282828        // Note that we don't clip out overflow for positioned objects.  We just stick to the border box.
    2829         IntRect flippedBlockRect = IntRect(offsetFromRootBlock.width(), offsetFromRootBlock.height(), width(), height());
     2829        LayoutRect flippedBlockRect(offsetFromRootBlock.width(), offsetFromRootBlock.height(), width(), height());
    28302830        rootBlock->flipForWritingMode(flippedBlockRect);
    28312831        flippedBlockRect.moveBy(rootBlockPhysicalPosition);
     
    28392839            for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) {
    28402840                FloatingObject* r = *it;
    2841                 IntRect floatBox = IntRect(offsetFromRootBlock.width() + xPositionForFloatIncludingMargin(r),
    2842                                            offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(r),
    2843                                            r->m_renderer->width(), r->m_renderer->height());
     2841                LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatIncludingMargin(r),
     2842                                    offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(r),
     2843                                    r->m_renderer->width(), r->m_renderer->height());
    28442844                rootBlock->flipForWritingMode(floatBox);
    28452845                floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y());
     
    28752875}
    28762876
    2877 GapRects RenderBlock::inlineSelectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
    2878                                           int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* paintInfo)
     2877GapRects RenderBlock::inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     2878                                          LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* paintInfo)
    28792879{
    28802880    GapRects result;
     
    28992899    // Now paint the gaps for the lines.
    29002900    for (; curr && curr->hasSelectedChildren(); curr = curr->nextRootBox()) {
    2901         int selTop =  curr->selectionTop();
    2902         int selHeight = curr->selectionHeight();
     2901        LayoutUnit selTop =  curr->selectionTop();
     2902        LayoutUnit selHeight = curr->selectionHeight();
    29032903
    29042904        if (!containsStart && !lastSelectedLine &&
     
    29072907                                                 selTop, paintInfo));
    29082908       
    2909         IntRect logicalRect(curr->logicalLeft(), selTop, curr->logicalWidth(), selTop + selHeight);
    2910         logicalRect.move(isHorizontalWritingMode() ? offsetFromRootBlock : IntSize(offsetFromRootBlock.height(), offsetFromRootBlock.width()));
     2909        LayoutRect logicalRect(curr->logicalLeft(), selTop, curr->logicalWidth(), selTop + selHeight);
     2910        logicalRect.move(isHorizontalWritingMode() ? offsetFromRootBlock : offsetFromRootBlock.transposedSize());
    29112911        IntRect physicalRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, logicalRect);
    29122912        if (!paintInfo || (isHorizontalWritingMode() && physicalRect.y() < paintInfo->rect.maxY() && physicalRect.maxY() > paintInfo->rect.y())
     
    29302930}
    29312931
    2932 GapRects RenderBlock::blockSelectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
    2933                                          int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* paintInfo)
     2932GapRects RenderBlock::blockSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     2933                                         LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* paintInfo)
    29342934{
    29352935    GapRects result;
     
    29502950            // If the relposition offset is anything other than 0, then treat this just like an absolute positioned element.
    29512951            // Just disregard it completely.
    2952             IntSize relOffset = curr->layer()->relativePositionOffset();
     2952            LayoutSize relOffset = curr->layer()->relativePositionOffset();
    29532953            if (relOffset.width() || relOffset.height())
    29542954                continue;
     
    29862986        } else if (childState != SelectionNone)
    29872987            // We must be a block that has some selected object inside it.  Go ahead and recur.
    2988             result.unite(toRenderBlock(curr)->selectionGaps(rootBlock, rootBlockPhysicalPosition, IntSize(offsetFromRootBlock.width() + curr->x(), offsetFromRootBlock.height() + curr->y()),
     2988            result.unite(toRenderBlock(curr)->selectionGaps(rootBlock, rootBlockPhysicalPosition, LayoutSize(offsetFromRootBlock.width() + curr->x(), offsetFromRootBlock.height() + curr->y()),
    29892989                                                            lastLogicalTop, lastLogicalLeft, lastLogicalRight, paintInfo));
    29902990    }
     
    29922992}
    29932993
    2994 IntRect RenderBlock::blockSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
    2995                                        int lastLogicalTop, int lastLogicalLeft, int lastLogicalRight, int logicalBottom, const PaintInfo* paintInfo)
    2996 {
    2997     int logicalTop = lastLogicalTop;
    2998     int logicalHeight = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalBottom - logicalTop;
    2999     if (logicalHeight <= 0)
    3000         return IntRect();
     2994LayoutRect RenderBlock::blockSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     2995                                          LayoutUnit lastLogicalTop, LayoutUnit lastLogicalLeft, LayoutUnit lastLogicalRight, LayoutUnit logicalBottom, const PaintInfo* paintInfo)
     2996{
     2997    LayoutUnit logicalTop = lastLogicalTop;
     2998    LayoutUnit logicalHeight = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalBottom - logicalTop;
     2999    if (logicalHeight <= static_cast<LayoutUnit>(0))
     3000        return LayoutRect();
    30013001
    30023002    // Get the selection offsets for the bottom of the gap
    3003     int logicalLeft = max(lastLogicalLeft, logicalLeftSelectionOffset(rootBlock, logicalBottom));
    3004     int logicalRight = min(lastLogicalRight, logicalRightSelectionOffset(rootBlock, logicalBottom));
    3005     int logicalWidth = logicalRight - logicalLeft;
    3006     if (logicalWidth <= 0)
    3007         return IntRect();
    3008 
    3009     IntRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, IntRect(logicalLeft, logicalTop, logicalWidth, logicalHeight));
     3003    LayoutUnit logicalLeft = max(lastLogicalLeft, logicalLeftSelectionOffset(rootBlock, logicalBottom));
     3004    LayoutUnit logicalRight = min(lastLogicalRight, logicalRightSelectionOffset(rootBlock, logicalBottom));
     3005    LayoutUnit logicalWidth = logicalRight - logicalLeft;
     3006    if (logicalWidth <= static_cast<LayoutUnit>(0))
     3007        return LayoutRect();
     3008
     3009    LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(logicalLeft, logicalTop, logicalWidth, logicalHeight));
    30103010    if (paintInfo)
    30113011        paintInfo->context->fillRect(gapRect, selectionBackgroundColor(), style()->colorSpace());
     
    30133013}
    30143014
    3015 IntRect RenderBlock::logicalLeftSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
    3016                                              RenderObject* selObj, int logicalLeft, int logicalTop, int logicalHeight, const PaintInfo* paintInfo)
    3017 {
    3018     int rootBlockLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalTop;
    3019     int rootBlockLogicalLeft = max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight));
    3020     int rootBlockLogicalRight = min(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalLeft, min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight)));
    3021     int rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;
    3022     if (rootBlockLogicalWidth <= 0)
    3023         return IntRect();
    3024 
    3025     IntRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, IntRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));
     3015LayoutRect RenderBlock::logicalLeftSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     3016                                                RenderObject* selObj, LayoutUnit logicalLeft, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo* paintInfo)
     3017{
     3018    LayoutUnit rootBlockLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalTop;
     3019    LayoutUnit rootBlockLogicalLeft = max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight));
     3020    LayoutUnit rootBlockLogicalRight = min(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalLeft, min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight)));
     3021    LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;
     3022    if (rootBlockLogicalWidth <= static_cast<LayoutUnit>(0))
     3023        return LayoutRect();
     3024
     3025    LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));
    30263026    if (paintInfo)
    30273027        paintInfo->context->fillRect(gapRect, selObj->selectionBackgroundColor(), selObj->style()->colorSpace());
     
    30293029}
    30303030
    3031 IntRect RenderBlock::logicalRightSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
    3032                                               RenderObject* selObj, int logicalRight, int logicalTop, int logicalHeight, const PaintInfo* paintInfo)
    3033 {
    3034     int rootBlockLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalTop;
    3035     int rootBlockLogicalLeft = max(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalRight, max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight)));
    3036     int rootBlockLogicalRight = min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight));
    3037     int rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;
    3038     if (rootBlockLogicalWidth <= 0)
    3039         return IntRect();
    3040 
    3041     IntRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, IntRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));
     3031LayoutRect RenderBlock::logicalRightSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     3032                                                 RenderObject* selObj, int logicalRight, int logicalTop, int logicalHeight, const PaintInfo* paintInfo)
     3033{
     3034    LayoutUnit rootBlockLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalTop;
     3035    LayoutUnit rootBlockLogicalLeft = max(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalRight, max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight)));
     3036    LayoutUnit rootBlockLogicalRight = min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight));
     3037    LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;
     3038    if (rootBlockLogicalWidth <= static_cast<LayoutUnit>(0))
     3039        return LayoutRect();
     3040
     3041    LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));
    30423042    if (paintInfo)
    30433043        paintInfo->context->fillRect(gapRect, selObj->selectionBackgroundColor(), selObj->style()->colorSpace());
     
    30563056}
    30573057
    3058 int RenderBlock::logicalLeftSelectionOffset(RenderBlock* rootBlock, int position)
    3059 {
    3060     int logicalLeft = logicalLeftOffsetForLine(position, false);
     3058LayoutUnit RenderBlock::logicalLeftSelectionOffset(RenderBlock* rootBlock, LayoutUnit position)
     3059{
     3060    LayoutUnit logicalLeft = logicalLeftOffsetForLine(position, false);
    30613061    if (logicalLeft == logicalLeftOffsetForContent()) {
    30623062        if (rootBlock != this)
     
    30743074}
    30753075
    3076 int RenderBlock::logicalRightSelectionOffset(RenderBlock* rootBlock, int position)
    3077 {
    3078     int logicalRight = logicalRightOffsetForLine(position, false);
     3076LayoutUnit RenderBlock::logicalRightSelectionOffset(RenderBlock* rootBlock, LayoutUnit position)
     3077{
     3078    LayoutUnit logicalRight = logicalRightOffsetForLine(position, false);
    30793079    if (logicalRight == logicalRightOffsetForContent()) {
    30803080        if (rootBlock != this)
     
    41464146}
    41474147
    4148 VisiblePosition RenderBlock::positionForPointWithInlineChildren(const IntPoint& pointInLogicalContents)
     4148VisiblePosition RenderBlock::positionForPointWithInlineChildren(const LayoutPoint& pointInLogicalContents)
    41494149{
    41504150    ASSERT(childrenInline());
     
    43374337}
    43384338
    4339 int RenderBlock::desiredColumnWidth() const
     4339LayoutUnit RenderBlock::desiredColumnWidth() const
    43404340{
    43414341    if (!hasColumns())
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r90590 r90596  
    299299    virtual void paintObject(PaintInfo&, const LayoutPoint&);
    300300
    301     int logicalRightOffsetForLine(int position, int fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const;
    302     int logicalLeftOffsetForLine(int position, int fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const;
     301    LayoutUnit logicalRightOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const;
     302    LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const;
    303303
    304304    virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const;
     
    613613    virtual void childBecameNonInline(RenderObject* child);
    614614
    615     virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool /*clipToVisibleContent*/)
     615    virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool /*clipToVisibleContent*/)
    616616    {
    617617        return selectionGapRectsForRepaint(repaintContainer);
     
    619619    virtual bool shouldPaintSelectionGaps() const;
    620620    bool isSelectionRoot() const;
    621     GapRects selectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
    622                            int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* = 0);
    623     GapRects inlineSelectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
    624                            int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo*);
    625     GapRects blockSelectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
    626                            int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo*);
    627     IntRect blockSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,
    628                               int lastLogicalTop, int lastLogicalLeft, int lastLogicalRight, int logicalBottom, const PaintInfo*);
    629     int logicalLeftSelectionOffset(RenderBlock* rootBlock, int position);
    630     int logicalRightSelectionOffset(RenderBlock* rootBlock, int position);
     621    GapRects selectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     622                           LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* = 0);
     623    GapRects inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     624                                 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo*);
     625    GapRects blockSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     626                                LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo*);
     627    IntRect blockSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock,
     628                              LayoutUnit lastLogicalTop, LayoutUnit lastLogicalLeft, LayoutUnit lastLogicalRight, LayoutUnit logicalBottom, const PaintInfo*);
     629    LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, LayoutUnit position);
     630    LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, LayoutUnit position);
    631631   
    632632    virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint& accumulatedOffset);
    633633    virtual void absoluteQuads(Vector<FloatQuad>&);
    634634
    635     int desiredColumnWidth() const;
     635    LayoutUnit desiredColumnWidth() const;
    636636    unsigned desiredColumnCount() const;
    637637    void setDesiredColumnCountAndWidth(int count, int width);
  • trunk/Source/WebCore/rendering/RenderListMarker.cpp

    r90069 r90596  
    16991699}
    17001700
    1701 IntRect RenderListMarker::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)
     1701LayoutRect RenderListMarker::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)
    17021702{
    17031703    ASSERT(!needsLayout());
    17041704
    17051705    if (selectionState() == SelectionNone || !inlineBoxWrapper())
    1706         return IntRect();
     1706        return LayoutRect();
    17071707
    17081708    RootInlineBox* root = inlineBoxWrapper()->root();
    1709     IntRect rect(0, root->selectionTop() - y(), width(), root->selectionHeight());
     1709    LayoutRect rect(0, root->selectionTop() - y(), width(), root->selectionHeight());
    17101710           
    17111711    if (clipToVisibleContent)
  • trunk/Source/WebCore/rendering/RenderListMarker.h

    r90048 r90596  
    6666
    6767    virtual void setSelectionState(SelectionState);
    68     virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);
     68    virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);
    6969    virtual bool canBeSelectionLeaf() const { return true; }
    7070
  • trunk/Source/WebCore/rendering/RenderObject.h

    r90590 r90596  
    704704    // A single rectangle that encompasses all of the selected objects within this object.  Used to determine the tightest
    705705    // possible bounding box for the selection.
    706     IntRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(0, clipToVisibleContent); }
    707     virtual IntRect selectionRectForRepaint(RenderBoxModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/ = true) { return IntRect(); }
     706    LayoutRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(0, clipToVisibleContent); }
     707    virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/ = true) { return LayoutRect(); }
    708708
    709709    // Whether or not an object can be part of the leaf elements of the selection.
  • trunk/Source/WebCore/rendering/RenderReplaced.cpp

    r90250 r90596  
    432432}
    433433
    434 IntRect RenderReplaced::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)
     434LayoutRect RenderReplaced::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)
    435435{
    436436    ASSERT(!needsLayout());
    437437
    438438    if (!isSelected())
    439         return IntRect();
    440    
    441     IntRect rect = localSelectionRect();
     439        return LayoutRect();
     440   
     441    LayoutRect rect = localSelectionRect();
    442442    if (clipToVisibleContent)
    443443        computeRectForRepaint(repaintContainer, rect);
  • trunk/Source/WebCore/rendering/RenderReplaced.h

    r90250 r90596  
    8282    virtual bool canBeSelectionLeaf() const { return true; }
    8383
    84     virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);
     84    virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);
    8585
    8686    IntSize m_intrinsicSize;
  • trunk/Source/WebCore/rendering/RenderSelectionInfo.h

    r76248 r90596  
    6363    RenderSelectionInfo(RenderObject* o, bool clipToVisibleContent)
    6464        : RenderSelectionInfoBase(o)
    65         , m_rect(o->needsLayout() ? IntRect() : o->selectionRectForRepaint(m_repaintContainer, clipToVisibleContent))
     65        , m_rect(o->needsLayout() ? LayoutRect() : o->selectionRectForRepaint(m_repaintContainer, clipToVisibleContent))
    6666    {
    6767    }
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r90530 r90596  
    13821382}
    13831383
    1384 IntRect RenderText::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)
     1384LayoutRect RenderText::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)
    13851385{
    13861386    ASSERT(!needsLayout());
    13871387
    13881388    if (selectionState() == SelectionNone)
    1389         return IntRect();
     1389        return LayoutRect();
    13901390    RenderBlock* cb = containingBlock();
    13911391    if (!cb)
    1392         return IntRect();
     1392        return LayoutRect();
    13931393
    13941394    // Now calculate startPos and endPos for painting selection.
    13951395    // We include a selection while endPos > 0
    1396     int startPos, endPos;
     1396    LayoutUnit startPos, endPos;
    13971397    if (selectionState() == SelectionInside) {
    13981398        // We are fully selected.
     
    14101410        return IntRect();
    14111411
    1412     IntRect rect;
     1412    LayoutRect rect;
    14131413    for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) {
    14141414        rect.unite(box->selectionRect(startPos, endPos));
  • trunk/Source/WebCore/rendering/RenderText.h

    r90530 r90596  
    9797    virtual bool canBeSelectionLeaf() const { return true; }
    9898    virtual void setSelectionState(SelectionState s);
    99     virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);
     99    virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);
    100100    virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0);
    101101
  • trunk/Source/WebCore/rendering/RootInlineBox.cpp

    r90515 r90596  
    397397}
    398398
    399 int RootInlineBox::selectionTop() const
    400 {
    401     int selectionTop = m_lineTop;
     399LayoutUnit RootInlineBox::selectionTop() const
     400{
     401    LayoutUnit selectionTop = m_lineTop;
    402402
    403403    if (m_hasAnnotationsBefore)
     
    407407        return selectionTop;
    408408
    409     int prevBottom = prevRootBox() ? prevRootBox()->selectionBottom() : block()->borderBefore() + block()->paddingBefore();
     409    LayoutUnit prevBottom = prevRootBox() ? prevRootBox()->selectionBottom() : block()->borderBefore() + block()->paddingBefore();
    410410    if (prevBottom < selectionTop && block()->containsFloats()) {
    411411        // This line has actually been moved further down, probably from a large line-height, but possibly because the
    412412        // line was forced to clear floats.  If so, let's check the offsets, and only be willing to use the previous
    413413        // line's bottom if the offsets are greater on both sides.
    414         int prevLeft = block()->logicalLeftOffsetForLine(prevBottom, false);
    415         int prevRight = block()->logicalRightOffsetForLine(prevBottom, false);
    416         int newLeft = block()->logicalLeftOffsetForLine(selectionTop, false);
    417         int newRight = block()->logicalRightOffsetForLine(selectionTop, false);
     414        LayoutUnit prevLeft = block()->logicalLeftOffsetForLine(prevBottom, false);
     415        LayoutUnit prevRight = block()->logicalRightOffsetForLine(prevBottom, false);
     416        LayoutUnit newLeft = block()->logicalLeftOffsetForLine(selectionTop, false);
     417        LayoutUnit newRight = block()->logicalRightOffsetForLine(selectionTop, false);
    418418        if (prevLeft > newLeft || prevRight < newRight)
    419419            return selectionTop;
     
    423423}
    424424
    425 int RootInlineBox::selectionBottom() const
    426 {
    427     int selectionBottom = m_lineBottom;
     425LayoutUnit RootInlineBox::selectionBottom() const
     426{
     427    LayoutUnit selectionBottom = m_lineBottom;
    428428
    429429    if (m_hasAnnotationsAfter)
     
    433433        return selectionBottom;
    434434
    435     int nextTop = nextRootBox()->selectionTop();
     435    LayoutUnit nextTop = nextRootBox()->selectionTop();
    436436    if (nextTop > selectionBottom && block()->containsFloats()) {
    437437        // The next line has actually been moved further over, probably from a large line-height, but possibly because the
    438438        // line was forced to clear floats.  If so, let's check the offsets, and only be willing to use the next
    439439        // line's top if the offsets are greater on both sides.
    440         int nextLeft = block()->logicalLeftOffsetForLine(nextTop, false);
    441         int nextRight = block()->logicalRightOffsetForLine(nextTop, false);
    442         int newLeft = block()->logicalLeftOffsetForLine(selectionBottom, false);
    443         int newRight = block()->logicalRightOffsetForLine(selectionBottom, false);
     440        LayoutUnit nextLeft = block()->logicalLeftOffsetForLine(nextTop, false);
     441        LayoutUnit nextRight = block()->logicalRightOffsetForLine(nextTop, false);
     442        LayoutUnit newLeft = block()->logicalLeftOffsetForLine(selectionBottom, false);
     443        LayoutUnit newRight = block()->logicalRightOffsetForLine(selectionBottom, false);
    444444        if (nextLeft > newLeft || nextRight < newRight)
    445445            return selectionBottom;
  • trunk/Source/WebCore/rendering/RootInlineBox.h

    r90515 r90596  
    5454    void setPaginationStrut(int s) { m_paginationStrut = s; }
    5555
    56     int selectionTop() const;
    57     int selectionBottom() const;
    58     int selectionHeight() const { return max(0, selectionBottom() - selectionTop()); }
     56    LayoutUnit selectionTop() const;
     57    LayoutUnit selectionBottom() const;
     58    LayoutUnit selectionHeight() const { return max<LayoutUnit>(0, selectionBottom() - selectionTop()); }
    5959
    6060    int blockDirectionPointInLine() const { return max(lineTop(), selectionTop()); }
Note: See TracChangeset for help on using the changeset viewer.