Changeset 139135 in webkit


Ignore:
Timestamp:
Jan 8, 2013 4:59:43 PM (11 years ago)
Author:
esprehn@chromium.org
Message:

Merge getLineAtIndex into RenderBlock::lineAtIndex
https://bugs.webkit.org/show_bug.cgi?id=106379

Reviewed by Eric Seidel.

getLineAtIndex can be merged into lineAtIndex, which was it's only caller.

No new tests, just refactoring.

  • rendering/RenderBlock.cpp:

(WebCore::RenderBlock::lineAtIndex):
(WebCore::RenderBlock::lineCount):

  • rendering/RenderBlock.h:

(RenderBlock):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r139132 r139135  
     12013-01-08  Elliott Sprehn  <esprehn@chromium.org>
     2
     3        Merge getLineAtIndex into RenderBlock::lineAtIndex
     4        https://bugs.webkit.org/show_bug.cgi?id=106379
     5
     6        Reviewed by Eric Seidel.
     7
     8        getLineAtIndex can be merged into lineAtIndex, which was it's only caller.
     9
     10        No new tests, just refactoring.
     11
     12        * rendering/RenderBlock.cpp:
     13        (WebCore::RenderBlock::lineAtIndex):
     14        (WebCore::RenderBlock::lineCount):
     15        * rendering/RenderBlock.h:
     16        (RenderBlock):
     17
    1182013-01-08  Rafael Weinstein  <rafaelw@chromium.org>
    219
  • trunk/Source/WebCore/rendering/RenderBlock.cpp

    r139040 r139135  
    65596559}
    65606560
    6561 static RootInlineBox* getLineAtIndex(RenderBlock* block, int i, int& count)
    6562 {
    6563     if (block->style()->visibility() == VISIBLE) {
    6564         if (block->childrenInline()) {
    6565             for (RootInlineBox* box = block->firstRootBox(); box; box = box->nextRootBox()) {
    6566                 if (count++ == i)
    6567                     return box;
    6568             }
    6569         }
    6570         else {
    6571             for (RenderObject* obj = block->firstChild(); obj; obj = obj->nextSibling()) {
    6572                 if (shouldCheckLines(obj)) {
    6573                     RootInlineBox *box = getLineAtIndex(toRenderBlock(obj), i, count);
    6574                     if (box)
    6575                         return box;
    6576                 }
    6577             }
    6578         }
    6579     }
    6580     return 0;
    6581 }
    6582 
    65836561static int getHeightForLineCount(RenderBlock* block, int l, bool includeBottom, int& count)
    65846562{
     
    66086586}
    66096587
    6610 RootInlineBox* RenderBlock::lineAtIndex(int i)
    6611 {
    6612     int count = 0;
    6613     return getLineAtIndex(this, i, count);
    6614 }
    6615 
    6616 int RenderBlock::lineCount()
     6588RootInlineBox* RenderBlock::lineAtIndex(int i) const
     6589{
     6590    ASSERT(i >= 0);
     6591
     6592    if (style()->visibility() != VISIBLE)
     6593        return 0;
     6594
     6595    if (childrenInline()) {
     6596        for (RootInlineBox* box = firstRootBox(); box; box = box->nextRootBox())
     6597            if (!i--)
     6598                return box;
     6599    } else {
     6600        for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
     6601            if (!shouldCheckLines(child))
     6602                continue;
     6603            if (RootInlineBox* box = toRenderBlock(child)->lineAtIndex(i))
     6604                return box;
     6605        }
     6606    }
     6607
     6608    return 0;
     6609}
     6610
     6611int RenderBlock::lineCount() const
    66176612{
    66186613    int count = 0;
  • trunk/Source/WebCore/rendering/RenderBlock.h

    r138196 r139135  
    239239
    240240    LayoutRect logicalRectToPhysicalRect(const LayoutPoint& physicalPosition, const LayoutRect& logicalRect);
    241        
     241
    242242    // Helper methods for computing line counts and heights for line counts.
    243     RootInlineBox* lineAtIndex(int);
    244     int lineCount();
     243    RootInlineBox* lineAtIndex(int) const;
     244    int lineCount() const;
    245245    int heightForLineCount(int);
    246246    void clearTruncation();
Note: See TracChangeset for help on using the changeset viewer.