[Webkit-unassigned] [Bug 40197] Enhance the hit testing to take a rectangle instead of a point

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jun 14 08:27:55 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=40197





--- Comment #24 from Antonio Gomes (tonikitoo) <tonikitoo at webkit.org>  2010-06-14 08:27:51 PST ---
(From update of attachment 58617)
Good progresses! Please see some more questions and comments below.

> +bool HitTestResult::addRawNodeForRegionTest(Node* node, int x, int y, const IntRect& rect)
> +{
> +    if (!isRegionTest() || !node)
> +        return false;
> +
> +    m_rawNodeList.add(node);
> +
> +    return !rect.contains(pointRect(x, y));
> +}

I'd add a comment here explaning why it is important to return true only if rect encloses pointRect(x,y): because call side can stop hittest in such cases.

> +    IntSize pointPadding() const { return m_pointPadding; }

maybe just padding()?

> +    IntRect pointRect(int x, int y) const;
> +    IntRect pointRect(const IntPoint&) const;

maybe rename these to hit{Area,Region}FromPoint ? pointRect is kinda meaningless.

> +inline IntRect HitTestResult::pointRect(int x, int y) const
> +{
> +    return IntRect(x - m_pointPadding.width(), y - m_pointPadding.height(), 2 * m_pointPadding.width() + 1, 2 * m_pointPadding.height() + 1);
> +}

hum, I missed the point on why +1 here. Could you explain? If that for cases when padding is IntSize(0,0)

if that is the case, just set it to IntSize(1,1) in the point-only constructor.

HitTestResult::HitTestResult(const IntPoint& point)
    : m_point(point)
    , m_padding(1, 1)
    , m_isOverWidget(false)
{
}


I will work on tests on top of this one for now.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list