Changeset 85677 in webkit


Ignore:
Timestamp:
May 3, 2011 3:33:25 PM (13 years ago)
Author:
mitz@apple.com
Message:

<rdar://problem/8891395> -[DOMRange textRects] returns incorrect results for vertical or flipped text
https://bugs.webkit.org/show_bug.cgi?id=60067

Reviewed by Darin Adler.

No test because this code path is only used by the Objective-C API, which is not testable from DumpRenderTree.

  • rendering/RenderText.cpp:

(WebCore::RenderText::absoluteRectsForRange): Use width/height instead of logicalWidth/logicalHeight here,
and perform the local-to-absolute mapping on the rects rather than their origin, in order to get the right
results for flipped writing modes.

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r85673 r85677  
     12011-05-03  Dan Bernstein  <mitz@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        <rdar://problem/8891395> -[DOMRange textRects] returns incorrect results for vertical or flipped text
     6        https://bugs.webkit.org/show_bug.cgi?id=60067
     7
     8        No test because this code path is only used by the Objective-C API, which is not testable from DumpRenderTree.
     9
     10        * rendering/RenderText.cpp:
     11        (WebCore::RenderText::absoluteRectsForRange): Use width/height instead of logicalWidth/logicalHeight here,
     12        and perform the local-to-absolute mapping on the rects rather than their origin, in order to get the right
     13        results for flipped writing modes.
     14
    1152011-05-03  Anton Muhin  <antonm@chromium.org>
    216
  • trunk/Source/WebCore/rendering/RenderText.cpp

    r85377 r85677  
    292292        // Note: box->end() returns the index of the last character, not the index past it
    293293        if (start <= box->start() && box->end() < end) {
    294             IntRect r = IntRect(box->x(), box->y(), box->logicalWidth(), box->logicalHeight());
     294            IntRect r = box->calculateBoundaries();
    295295            if (useSelectionHeight) {
    296296                IntRect selectionRect = box->selectionRect(0, 0, start, end);
    297                 r.setHeight(selectionRect.height());
    298                 r.setY(selectionRect.y());
     297                if (box->isHorizontal()) {
     298                    r.setHeight(selectionRect.height());
     299                    r.setY(selectionRect.y());
     300                } else {
     301                    r.setWidth(selectionRect.width());
     302                    r.setX(selectionRect.x());
     303                }
    299304            }
    300             FloatPoint origin = localToAbsolute(r.location());
    301             r.setX(origin.x());
    302             r.setY(origin.y());
    303             rects.append(r);
     305            rects.append(localToAbsoluteQuad(FloatQuad(r)).enclosingBoundingBox());
    304306        } else {
    305307            unsigned realEnd = min(box->end() + 1, end);
     
    308310                if (!useSelectionHeight) {
    309311                    // change the height and y position because selectionRect uses selection-specific values
    310                     r.setHeight(box->logicalHeight());
    311                     r.setY(box->y());
     312                    if (box->isHorizontal()) {
     313                        r.setHeight(box->logicalHeight());
     314                        r.setY(box->y());
     315                    } else {
     316                        r.setWidth(box->logicalWidth());
     317                        r.setX(box->x());
     318                    }
    312319                }
    313                 FloatPoint origin = localToAbsolute(r.location());
    314                 localToAbsolute(origin);
    315                 r.setX(origin.x());
    316                 r.setY(origin.y());
    317                 rects.append(r);
     320                rects.append(localToAbsoluteQuad(FloatQuad(r)).enclosingBoundingBox());
    318321            }
    319322        }
Note: See TracChangeset for help on using the changeset viewer.