Changeset 125306 in webkit


Ignore:
Timestamp:
Aug 10, 2012 11:42:38 AM (12 years ago)
Author:
allan.jensen@nokia.com
Message:

[Transforms] Hit test issue with large scale() transform
https://bugs.webkit.org/show_bug.cgi?id=23170

Reviewed by Simon Fraser.

Source/WebCore:

By using normal rounding to determine the top-left corner of the
hit-tested rectangle, we end up offsetting the hit test by up to
half a pixel, once scaled to x60, this creates a 30px error.

Normal rounding is replaced with floored rounding which means the
hit-tested pixel will now always be the pixel containing the
point.

Test: fast/transforms/hit-test-large-scale.html

  • rendering/HitTestResult.cpp:

(WebCore::HitTestPoint::HitTestPoint):
(WebCore::HitTestPoint::intersectsRect):
(WebCore::HitTestPoint::rectForPoint):

LayoutTests:

New test checking that we can hit the bottom-right part of an element with
a large scale transformation.

Modified test-input on perspective-clipped.html, since it was mathematically
0.1px inside the transformed target, but used to miss due to bad rounding.

  • fast/transforms/hit-test-large-scale-expected.txt: Added.
  • fast/transforms/hit-test-large-scale.html: Added.
  • transforms/3d/hit-testing/perspective-clipped-expected.txt:
  • transforms/3d/hit-testing/perspective-clipped.html:
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r125304 r125306  
     12012-08-10  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
     2
     3        [Transforms] Hit test issue with large scale() transform
     4        https://bugs.webkit.org/show_bug.cgi?id=23170
     5
     6        Reviewed by Simon Fraser.
     7
     8        New test checking that we can hit the bottom-right part of an element with
     9        a large scale transformation.
     10
     11        Modified test-input on perspective-clipped.html, since it was mathematically
     12        0.1px inside the transformed target, but used to miss due to bad rounding.
     13
     14        * fast/transforms/hit-test-large-scale-expected.txt: Added.
     15        * fast/transforms/hit-test-large-scale.html: Added.
     16        * transforms/3d/hit-testing/perspective-clipped-expected.txt:
     17        * transforms/3d/hit-testing/perspective-clipped.html:
     18
    1192012-08-10  Takashi Sakamoto  <tasak@google.com>
    220
  • trunk/LayoutTests/transforms/3d/hit-testing/perspective-clipped-expected.txt

    r116543 r125306  
    1010Element at 370, 280 has id "bottomLayer": PASS
    1111Element at 35, 340 has id "backgroundLayer": PASS
    12 Element at 370, 340 has id "backgroundLayer": PASS
     12Element at 371, 340 has id "backgroundLayer": PASS
    1313
  • trunk/LayoutTests/transforms/3d/hit-testing/perspective-clipped.html

    r116543 r125306  
    8080        // Points within the axis-aligned bounding box of the bottom layer, but not actually on the layer itself
    8181        { 'point': [35, 340], 'target' : 'backgroundLayer' },
    82         { 'point': [370, 340], 'target' : 'backgroundLayer' },
     82        { 'point': [371, 340], 'target' : 'backgroundLayer' },
    8383      ];
    8484
  • trunk/Source/WebCore/ChangeLog

    r125305 r125306  
     12012-08-10  Allan Sandfeld Jensen  <allan.jensen@nokia.com>
     2
     3        [Transforms] Hit test issue with large scale() transform
     4        https://bugs.webkit.org/show_bug.cgi?id=23170
     5
     6        Reviewed by Simon Fraser.
     7
     8        By using normal rounding to determine the top-left corner of the
     9        hit-tested rectangle, we end up offsetting the hit test by up to
     10        half a pixel, once scaled to x60, this creates a 30px error.
     11
     12        Normal rounding is replaced with floored rounding which means the
     13        hit-tested pixel will now always be the pixel containing the
     14        point.
     15
     16        Test: fast/transforms/hit-test-large-scale.html
     17
     18        * rendering/HitTestResult.cpp:
     19        (WebCore::HitTestPoint::HitTestPoint):
     20        (WebCore::HitTestPoint::intersectsRect):
     21        (WebCore::HitTestPoint::rectForPoint):
     22
    1232012-08-10  Florin Malita  <fmalita@chromium.org>
    224
  • trunk/Source/WebCore/rendering/HitTestResult.cpp

    r123754 r125306  
    6868
    6969HitTestPoint::HitTestPoint(const FloatPoint& point)
    70     : m_point(roundedLayoutPoint(point))
     70    : m_point(flooredLayoutPoint(point))
    7171    , m_boundingBox(rectForPoint(m_point, 0, 0, 0, 0))
    7272    , m_transformedPoint(point)
     
    8484    , m_isRectBased(true)
    8585{
    86     m_point = roundedLayoutPoint(point);
     86    m_point = flooredLayoutPoint(point);
    8787    m_boundingBox = enclosingIntRect(quad.boundingBox());
    8888    m_isRectilinear = quad.isRectilinear();
     
    182182IntRect HitTestPoint::rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
    183183{
    184     IntPoint actualPoint(roundedIntPoint(point));
     184    IntPoint actualPoint(flooredIntPoint(point));
    185185    actualPoint -= IntSize(leftPadding, topPadding);
    186186
Note: See TracChangeset for help on using the changeset viewer.