Bug 89448 - Use HitTestPoint instead of LayoutPoint for nodeAtPoint
Summary: Use HitTestPoint instead of LayoutPoint for nodeAtPoint
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Allan Sandfeld Jensen
URL:
Keywords:
Depends on:
Blocks: 85792 89454
  Show dependency treegraph
 
Reported: 2012-06-19 02:18 PDT by Allan Sandfeld Jensen
Modified: 2012-06-20 08:42 PDT (History)
7 users (show)

See Also:


Attachments
Patch (99.73 KB, patch)
2012-06-19 02:24 PDT, Allan Sandfeld Jensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Allan Sandfeld Jensen 2012-06-19 02:18:46 PDT
The HitTestPoint class introduced in bug #85965, is supposed to replace LayoutPoint as the point tested in nodeAtPoint. This is necessary to fix area-based hittesting on transformed elements, bug #85792.
Comment 1 Allan Sandfeld Jensen 2012-06-19 02:24:34 PDT
Created attachment 148293 [details]
Patch
Comment 2 Eric Seidel (no email) 2012-06-19 06:41:35 PDT
The answers to https://bugs.webkit.org/show_bug.cgi?id=85792#c27 will make reviewing this patch trivial. :)

You'll likely find eae, leviw and smfr to be good reviewers for these sorts of patches as they're familiar with both the subpixel rendering support and rendering tree transformations/hittesting.  I'm also happy to help with these reviews.
Comment 3 Eric Seidel (no email) 2012-06-20 08:13:03 PDT
Comment on attachment 148293 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=148293&action=review

Thank you again for hte long explanations both on the bugs, and over IRC.

I have real concern about the long-term readability of this code due to the really port class, function and variable namings.  These new objects are more than points, and naming them HitTestPoint is just confusing.

HitRegion would be one possible suggested replacement.

In eithe rcase, this patch is OK, but we really need to fix this code to read more clearly before we're done here.

> Source/WebCore/rendering/InlineFlowBox.cpp:969
> -    if (!overflowRect.intersects(result.rectForPoint(pointInContainer)))
> +    if (!pointInContainer.intersects(overflowRect))

So we're going to remove rectForPoint in this new model?

> Source/WebCore/rendering/RenderLayer.cpp:3631
> -    if (bgRect.intersects(hitTestArea) && isSelfPaintingLayer()) {
> +    if (bgRect.intersects(hitTestPoint) && isSelfPaintingLayer()) {

Seems like a sad name change. :(

> Source/WebCore/rendering/RenderLayer.h:118
> +    bool intersects(const HitTestPoint&);

Unclear to me if this what it's going to look like in the end.  It seems that clipRect and HitTestPoint both represent possibly non-rectilinear shapes.

> Source/WebCore/rendering/RenderLineBoxList.cpp:287
> +    LayoutPoint point = pointInContainer.point();

This and many similar renames could hav been avoided by changing the argument to something else and using a pointInContainer local which was actually a LayoutPOint.
Comment 4 Allan Sandfeld Jensen 2012-06-20 08:18:12 PDT
(In reply to comment #3)
> I have real concern about the long-term readability of this code due to the really port class, function and variable namings.  These new objects are more than points, and naming them HitTestPoint is just confusing.
> 
> HitRegion would be one possible suggested replacement.
> 
The term point here is a point the same way a touch-point is, since touch points also has an area, but I can see how it might be confusing. 

Unfortunately Region is also a really overloaded name in WebKit rendering terms, so maybe HitTestArea or TouchPoint would work?
Comment 5 Eric Seidel (no email) 2012-06-20 08:21:56 PDT
I guess I dont' like TouchPoint either, since it's not a point. :)

It would be nice if while you're in here you came up with a cohenent vision for what hit testing should look like.  it appears to me that he hit testing code hasn't had someone come and love it in a long time. :)

I would be fine with HitTestArea or HitArea.  Region is definitely an overloaded term, but I'm not sure that HitRegion makes that overloading any worse. :)
Comment 6 WebKit Review Bot 2012-06-20 08:42:13 PDT
Comment on attachment 148293 [details]
Patch

Clearing flags on attachment: 148293

Committed r120824: <http://trac.webkit.org/changeset/120824>
Comment 7 WebKit Review Bot 2012-06-20 08:42:18 PDT
All reviewed patches have been landed.  Closing bug.