Changeset 114926 in webkit


Ignore:
Timestamp:
Apr 23, 2012 11:59:59 AM (12 years ago)
Author:
eae@chromium.org
Message:

Clean up subpixel unit handling in hit testing code
https://bugs.webkit.org/show_bug.cgi?id=84496

Reviewed by Eric Seidel.

Fix use of IntRect and LayoutRect in hit testing code in preparation for
subpixel layout.

No new tests, no change in functionality.

  • rendering/HitTestResult.cpp:

(WebCore::HitTestResult::rectForPoint):
Revert rectForPoint to IntRect as all call sites converted it to an
IntRect anyway to compare it with an IntPoint or another IntRect.

  • rendering/HitTestingTransformState.cpp:

(WebCore::HitTestingTransformState::boundsOfMappedQuad):

  • rendering/HitTestingTransformState.h:

Convert boundsOfMappedQuad to LayoutRect as the TransformationMatrix now
has subpixel precision.

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r114925 r114926  
     12012-04-23  Emil A Eklund  <eae@chromium.org>
     2
     3        Clean up subpixel unit handling in hit testing code
     4        https://bugs.webkit.org/show_bug.cgi?id=84496
     5
     6        Reviewed by Eric Seidel.
     7
     8        Fix use of IntRect and LayoutRect in hit testing code in preparation for
     9        subpixel layout.
     10
     11        No new tests, no change in functionality.
     12
     13        * rendering/HitTestResult.cpp:
     14        (WebCore::HitTestResult::rectForPoint):
     15        Revert rectForPoint to IntRect as all call sites converted it to an
     16        IntRect anyway to compare it with an IntPoint or another IntRect.
     17
     18        * rendering/HitTestingTransformState.cpp:
     19        (WebCore::HitTestingTransformState::boundsOfMappedQuad):
     20        * rendering/HitTestingTransformState.h:
     21        Convert boundsOfMappedQuad to LayoutRect as the TransformationMatrix now
     22        has subpixel precision.
     23
    1242012-04-23  Kentaro Hara  <haraken@chromium.org>
    225
  • trunk/Source/WebCore/rendering/HitTestResult.cpp

    r113358 r114926  
    653653}
    654654
    655 LayoutRect HitTestResult::rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
    656 {
    657     LayoutPoint actualPoint(point);
    658     actualPoint -= LayoutSize(leftPadding, topPadding);
     655IntRect HitTestResult::rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
     656{
     657    IntPoint actualPoint(roundedIntPoint(point));
     658    actualPoint -= IntSize(leftPadding, topPadding);
    659659
    660660    IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding);
     
    662662    actualPadding += IntSize(1, 1);
    663663
    664     return LayoutRect(actualPoint, actualPadding);
     664    return IntRect(actualPoint, actualPadding);
    665665}
    666666
  • trunk/Source/WebCore/rendering/HitTestResult.h

    r113329 r114926  
    113113    // Rect-based hit test related methods.
    114114    bool isRectBasedTest() const { return m_isRectBased; }
    115     LayoutRect rectForPoint(const LayoutPoint&) const;
    116     static LayoutRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
     115    IntRect rectForPoint(const LayoutPoint&) const;
     116    static IntRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
    117117    int topPadding() const { return m_topPadding; }
    118118    int rightPadding() const { return m_rightPadding; }
     
    163163// width = leftPadding + rightPadding + 1
    164164// height = topPadding + bottomPadding + 1
    165 inline LayoutRect HitTestResult::rectForPoint(const LayoutPoint& point) const
     165inline IntRect HitTestResult::rectForPoint(const LayoutPoint& point) const
    166166{
    167167    return rectForPoint(point, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding);
  • trunk/Source/WebCore/rendering/HitTestingTransformState.cpp

    r98361 r114926  
    7474}
    7575
    76 IntRect HitTestingTransformState::boundsOfMappedQuad() const
     76LayoutRect HitTestingTransformState::boundsOfMappedQuad() const
    7777{
    7878    return m_accumulatedTransform.inverse().clampedBoundsOfProjectedQuad(m_lastPlanarQuad);
  • trunk/Source/WebCore/rendering/HitTestingTransformState.h

    r98361 r114926  
    5959    FloatPoint mappedPoint() const;
    6060    FloatQuad mappedQuad() const;
    61     IntRect boundsOfMappedQuad() const;
     61    LayoutRect boundsOfMappedQuad() const;
    6262    void flatten();
    6363
Note: See TracChangeset for help on using the changeset viewer.