Changeset 113466 in webkit


Ignore:
Timestamp:
Apr 6, 2012 11:34:43 AM (12 years ago)
Author:
leviw@chromium.org
Message:

Update LayoutUnit usage in Editor and Frame
https://bugs.webkit.org/show_bug.cgi?id=83278

Reviewed by Eric Seidel.

Frame and Editor both take input from the embedder, which passes along coordinates in screen
coordinates, which aren't fractional. Updating a few remaining functions to show this, and correcting
some inconsistencies in LayoutUnit usage.

No new tests. No change in behavior.

  • editing/Editor.cpp:

(WebCore::Editor::rangeForPoint): windowToContents returns an IntPoint.
(WebCore::Editor::countMatchesForText): Using enclosingIntRect since we're (fake) repainting the entire
view rect.

  • editing/Editor.h:

(Editor): Correcting mismatched function signature.

  • page/Frame.cpp:

(WebCore::Frame::visiblePositionForPoint): Frame takes points in screen coordinates, usually from the
embedder. Changing these functions to be in IntPoints.
(WebCore::Frame::documentAtPoint): Ditto.
(WebCore::Frame::rangeForPoint): Ditto.

  • page/Frame.h:

(Frame):

  • platform/graphics/IntRect.h:

(enclosingIntRect): Adding an inline no-op copy of the FractionalLayoutRect method enclosingIntRect.

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r113462 r113466  
     12012-04-06  Levi Weintraub  <leviw@chromium.org>
     2
     3        Update LayoutUnit usage in Editor and Frame
     4        https://bugs.webkit.org/show_bug.cgi?id=83278
     5
     6        Reviewed by Eric Seidel.
     7
     8        Frame and Editor both take input from the embedder, which passes along coordinates in screen
     9        coordinates, which aren't fractional. Updating a few remaining functions to show this, and correcting
     10        some inconsistencies in LayoutUnit usage.
     11
     12        No new tests. No change in behavior.
     13
     14        * editing/Editor.cpp:
     15        (WebCore::Editor::rangeForPoint): windowToContents returns an IntPoint.
     16        (WebCore::Editor::countMatchesForText): Using enclosingIntRect since we're (fake) repainting the entire
     17        view rect.
     18        * editing/Editor.h:
     19        (Editor): Correcting mismatched function signature.
     20        * page/Frame.cpp:
     21        (WebCore::Frame::visiblePositionForPoint): Frame takes points in screen coordinates, usually from the
     22        embedder. Changing these functions to be in IntPoints.
     23        (WebCore::Frame::documentAtPoint): Ditto.
     24        (WebCore::Frame::rangeForPoint): Ditto.
     25        * page/Frame.h:
     26        (Frame):
     27        * platform/graphics/IntRect.h:
     28        (enclosingIntRect): Adding an inline no-op copy of the FractionalLayoutRect method enclosingIntRect.
     29
    1302012-04-06  Tommy Widenflycht  <tommyw@google.com>
    231
  • trunk/Source/WebCore/editing/Editor.cpp

    r113405 r113466  
    22492249    if (!frameView)
    22502250        return 0;
    2251     LayoutPoint framePoint = frameView->windowToContents(windowPoint);
     2251    IntPoint framePoint = frameView->windowToContents(windowPoint);
    22522252    VisibleSelection selection(frame->visiblePositionForPoint(framePoint));
    22532253    return avoidIntersectionWithNode(selection.toNormalizedRange().get(), m_deleteButtonController->containerElement());
     
    28692869                PaintBehavior oldBehavior = m_frame->view()->paintBehavior();
    28702870                m_frame->view()->setPaintBehavior(oldBehavior | PaintBehaviorFlattenCompositingLayers);
    2871                 m_frame->view()->paintContents(&context, visibleRect);
     2871                m_frame->view()->paintContents(&context, enclosingIntRect(visibleRect));
    28722872                m_frame->view()->setPaintBehavior(oldBehavior);
    28732873            }
  • trunk/Source/WebCore/editing/Editor.h

    r113187 r113466  
    301301    void setStartNewKillRingSequence(bool);
    302302
    303     PassRefPtr<Range> rangeForPoint(const LayoutPoint& windowPoint);
     303    PassRefPtr<Range> rangeForPoint(const IntPoint& windowPoint);
    304304
    305305    void clear();
  • trunk/Source/WebCore/page/Frame.cpp

    r111836 r113466  
    726726}
    727727
    728 VisiblePosition Frame::visiblePositionForPoint(const LayoutPoint& framePoint)
     728VisiblePosition Frame::visiblePositionForPoint(const IntPoint& framePoint)
    729729{
    730730    HitTestResult result = eventHandler()->hitTestResultAtPoint(framePoint, true);
     
    746746        return 0;
    747747
    748     LayoutPoint pt = view()->windowToContents(point);
     748    IntPoint pt = view()->windowToContents(point);
    749749    HitTestResult result = HitTestResult(pt);
    750750
     
    754754}
    755755
    756 PassRefPtr<Range> Frame::rangeForPoint(const LayoutPoint& framePoint)
     756PassRefPtr<Range> Frame::rangeForPoint(const IntPoint& framePoint)
    757757{
    758758    VisiblePosition position = visiblePositionForPoint(framePoint);
  • trunk/Source/WebCore/page/Frame.h

    r111361 r113466  
    180180        DragImageRef dragImageForSelection();
    181181
    182         VisiblePosition visiblePositionForPoint(const LayoutPoint& framePoint);
     182        VisiblePosition visiblePositionForPoint(const IntPoint& framePoint);
    183183        Document* documentAtPoint(const IntPoint& windowPoint);
    184         PassRefPtr<Range> rangeForPoint(const LayoutPoint& framePoint);
     184        PassRefPtr<Range> rangeForPoint(const IntPoint& framePoint);
    185185
    186186        String searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*, size_t* resultDistanceFromStartOfCell);
  • trunk/Source/WebCore/platform/graphics/IntRect.h

    r113030 r113466  
    273273}
    274274
     275// FIXME: This method is here only to ease the transition to sub-pixel layout. It should
     276// be removed when we close http://webkit.org/b/60318
     277inline IntRect enclosingIntRect(const IntRect& rect)
     278{
     279    return rect;
     280}
     281
    275282#if USE(CG) || USE(SKIA_ON_MAC_CHROMIUM)
    276283IntRect enclosingIntRect(const CGRect&);
Note: See TracChangeset for help on using the changeset viewer.