Changeset 99113 in webkit


Ignore:
Timestamp:
Nov 2, 2011 3:53:39 PM (12 years ago)
Author:
eae@chromium.org
Message:

Switch RenderText to new layout types
https://bugs.webkit.org/show_bug.cgi?id=71389

Reviewed by Eric Seidel.

Switch RenderText methods (and overriden methods in related classes) to
LayoutRect/LayoutUnit.

No new tests.

  • rendering/RenderText.cpp:

(WebCore::RenderText::absoluteRectsForRange):
(WebCore::RenderText::linesBoundingBox):
(WebCore::RenderText::linesVisualOverflowBoundingBox):

  • rendering/RenderText.h:

Change RenderText to expose its bounding box, selection and caret rects
as LayoutRects.

  • rendering/svg/RenderSVGInlineText.cpp:

(WebCore::RenderSVGInlineText::localCaretRect):

  • rendering/svg/RenderSVGInlineText.h:

Change localCaretRect to return a LayoutRect.

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r99109 r99113  
     12011-11-02  Emil A Eklund  <eae@chromium.org>
     2
     3        Switch RenderText to new layout types
     4        https://bugs.webkit.org/show_bug.cgi?id=71389
     5
     6        Reviewed by Eric Seidel.
     7
     8        Switch RenderText methods (and overriden methods in related classes) to
     9        LayoutRect/LayoutUnit.
     10
     11        No new tests.
     12
     13        * rendering/RenderText.cpp:
     14        (WebCore::RenderText::absoluteRectsForRange):
     15        (WebCore::RenderText::linesBoundingBox):
     16        (WebCore::RenderText::linesVisualOverflowBoundingBox):
     17        * rendering/RenderText.h:
     18        Change RenderText to expose its bounding box, selection and caret rects
     19        as LayoutRects.
     20       
     21        * rendering/svg/RenderSVGInlineText.cpp:
     22        (WebCore::RenderSVGInlineText::localCaretRect):
     23        * rendering/svg/RenderSVGInlineText.h:
     24        Change localCaretRect to return a LayoutRect.
     25
    1262011-11-02  Levi Weintraub  <leviw@chromium.org>
    227
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r98883 r99113  
    329329}
    330330
    331 void RenderText::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed)
     331void RenderText::absoluteRectsForRange(Vector<LayoutRect>& rects, unsigned start, unsigned end, bool useSelectionHeight, bool* wasFixed)
    332332{
    333333    // Work around signed/unsigned issues. This function takes unsigneds, and is often passed UINT_MAX
     
    14981498}
    14991499
    1500 IntRect RenderText::linesVisualOverflowBoundingBox() const
     1500LayoutRect RenderText::linesVisualOverflowBoundingBox() const
    15011501{
    15021502    if (!firstTextBox())
    1503         return IntRect();
     1503        return LayoutRect();
    15041504
    15051505    // Return the width of the minimal left side and the maximal right side.
    1506     int logicalLeftSide = numeric_limits<int>::max();
    1507     int logicalRightSide = numeric_limits<int>::min();
     1506    LayoutUnit logicalLeftSide = numeric_limits<LayoutUnit>::max();
     1507    LayoutUnit logicalRightSide = numeric_limits<LayoutUnit>::min();
    15081508    for (InlineTextBox* curr = firstTextBox(); curr; curr = curr->nextTextBox()) {
    15091509        logicalLeftSide = min(logicalLeftSide, curr->logicalLeftVisualOverflow());
     
    15111511    }
    15121512   
    1513     int logicalTop = firstTextBox()->logicalTopVisualOverflow();
    1514     int logicalWidth = logicalRightSide - logicalLeftSide;
    1515     int logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - logicalTop;
     1513    LayoutUnit logicalTop = firstTextBox()->logicalTopVisualOverflow();
     1514    LayoutUnit logicalWidth = logicalRightSide - logicalLeftSide;
     1515    LayoutUnit logicalHeight = lastTextBox()->logicalBottomVisualOverflow() - logicalTop;
    15161516   
    1517     IntRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight);
     1517    LayoutRect rect(logicalLeftSide, logicalTop, logicalWidth, logicalHeight);
    15181518    if (!style()->isHorizontalWritingMode())
    15191519        rect = rect.transposedRect();
  • trunk/Source/WebCore/rendering/RenderText.h

    r98883 r99113  
    5656
    5757    virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint& accumulatedOffset) const;
    58     void absoluteRectsForRange(Vector<IntRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0);
     58    void absoluteRectsForRange(Vector<LayoutRect>&, unsigned startOffset = 0, unsigned endOffset = UINT_MAX, bool useSelectionHeight = false, bool* wasFixed = 0);
    5959
    6060    virtual void absoluteQuads(Vector<FloatQuad>&, bool* wasFixed) const;
     
    8484
    8585    virtual LayoutRect linesBoundingBox() const;
    86     IntRect linesVisualOverflowBoundingBox() const;
     86    LayoutRect linesVisualOverflowBoundingBox() const;
    8787
    8888    FloatPoint firstRunOrigin() const;
     
    151151    virtual unsigned length() const { return textLength(); }
    152152
    153     virtual void paint(PaintInfo&, const IntPoint&) { ASSERT_NOT_REACHED(); }
     153    virtual void paint(PaintInfo&, const LayoutPoint&) { ASSERT_NOT_REACHED(); }
    154154    virtual void layout() { ASSERT_NOT_REACHED(); }
    155155    virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const LayoutPoint&, const LayoutPoint&, HitTestAction) { ASSERT_NOT_REACHED(); return false; }
  • trunk/Source/WebCore/rendering/svg/RenderSVGInlineText.cpp

    r98883 r99113  
    105105}
    106106
    107 LayoutRect RenderSVGInlineText::localCaretRect(InlineBox* box, int caretOffset, int*)
     107LayoutRect RenderSVGInlineText::localCaretRect(InlineBox* box, int caretOffset, LayoutUnit*)
    108108{
    109109    if (!box->isInlineTextBox())
Note: See TracChangeset for help on using the changeset viewer.