⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 90603 in webkit


Ignore:
Timestamp:
Jul 7, 2011, 5:17:24 PM (15 years ago)
Author:
eae@chromium.org
Message:

Switch HitTestResult to to new layout types
https://bugs.webkit.org/show_bug.cgi?id=64131

Reviewed by Eric Seidel.

No new tests, no functionality changes.

  • page/MouseEventWithHitTestResults.cpp:

(WebCore::MouseEventWithHitTestResults::localPoint):

  • page/MouseEventWithHitTestResults.h:
  • rendering/HitTestResult.cpp:

(WebCore::HitTestResult::HitTestResult):
(WebCore::HitTestResult::addNodeToRectBasedTestResult):
(WebCore::HitTestResult::rectForPoint):

  • rendering/HitTestResult.h:

(WebCore::HitTestResult::point):
(WebCore::HitTestResult::localPoint):
(WebCore::HitTestResult::setPoint):
(WebCore::HitTestResult::setLocalPoint):
(WebCore::HitTestResult::rectForPoint):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r90600 r90603  
     12011-07-07  Emil A Eklund  <eae@chromium.org>
     2
     3        Switch HitTestResult to to new layout types
     4        https://bugs.webkit.org/show_bug.cgi?id=64131
     5
     6        Reviewed by Eric Seidel.
     7
     8        No new tests, no functionality changes.
     9
     10        * page/MouseEventWithHitTestResults.cpp:
     11        (WebCore::MouseEventWithHitTestResults::localPoint):
     12        * page/MouseEventWithHitTestResults.h:
     13        * rendering/HitTestResult.cpp:
     14        (WebCore::HitTestResult::HitTestResult):
     15        (WebCore::HitTestResult::addNodeToRectBasedTestResult):
     16        (WebCore::HitTestResult::rectForPoint):
     17        * rendering/HitTestResult.h:
     18        (WebCore::HitTestResult::point):
     19        (WebCore::HitTestResult::localPoint):
     20        (WebCore::HitTestResult::setPoint):
     21        (WebCore::HitTestResult::setLocalPoint):
     22        (WebCore::HitTestResult::rectForPoint):
     23
    1242011-07-07  Levi Weintraub  <leviw@chromium.org>
    225
  • trunk/Source/WebCore/page/MouseEventWithHitTestResults.cpp

    r83153 r90603  
    3434}
    3535
    36 const IntPoint MouseEventWithHitTestResults::localPoint() const
     36const LayoutPoint MouseEventWithHitTestResults::localPoint() const
    3737{
    3838    return m_hitTestResult.localPoint();
  • trunk/Source/WebCore/page/MouseEventWithHitTestResults.h

    r83153 r90603  
    3535    const PlatformMouseEvent& event() const { return m_event; }
    3636    const HitTestResult& hitTestResult() const { return m_hitTestResult; }
    37     const IntPoint localPoint() const;
     37    const LayoutPoint localPoint() const;
    3838    Scrollbar* scrollbar() const;
    3939    bool isOverLink() const;
  • trunk/Source/WebCore/rendering/HitTestResult.cpp

    r87539 r90603  
    5656}
    5757
    58 HitTestResult::HitTestResult(const IntPoint& point)
     58HitTestResult::HitTestResult(const LayoutPoint& point)
    5959    : m_point(point)
    6060    , m_isOverWidget(false)
     
    6767}
    6868
    69 HitTestResult::HitTestResult(const IntPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
     69HitTestResult::HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
    7070    : m_point(centerPoint)
    7171    , m_isOverWidget(false)
     
    509509}
    510510
    511 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const IntPoint& pointInContainer, const IntRect& rect)
     511bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const LayoutPoint& pointInContainer, const LayoutRect& rect)
    512512{
    513513    // If it is not a rect-based hit test, this method has to be no-op.
     
    540540}
    541541
    542 bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const IntPoint& pointInContainer, const FloatRect& rect)
     542bool HitTestResult::addNodeToRectBasedTestResult(Node* node, const LayoutPoint& pointInContainer, const FloatRect& rect)
    543543{
    544544    // If it is not a rect-based hit test, this method has to be no-op.
     
    591591}
    592592
    593 IntRect HitTestResult::rectForPoint(const IntPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
    594 {
    595     IntPoint actualPoint(point);
    596     actualPoint -= IntSize(leftPadding, topPadding);
     593LayoutRect HitTestResult::rectForPoint(const LayoutPoint& point, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding)
     594{
     595    LayoutPoint actualPoint(point);
     596    actualPoint -= LayoutSize(leftPadding, topPadding);
    597597
    598598    IntSize actualPadding(leftPadding + rightPadding, topPadding + bottomPadding);
     
    600600    actualPadding += IntSize(1, 1);
    601601
    602     return IntRect(actualPoint, actualPadding);
     602    return LayoutRect(actualPoint, actualPadding);
    603603}
    604604
  • trunk/Source/WebCore/rendering/HitTestResult.h

    r87018 r90603  
    2222
    2323#include "FloatRect.h"
    24 #include "IntPoint.h"
    25 #include "IntRect.h"
    26 #include "IntSize.h"
     24#include "LayoutTypes.h"
    2725#include "TextDirection.h"
    2826#include <wtf/Forward.h>
     
    3937#endif
    4038class Image;
    41 class IntRect;
    4239class KURL;
    4340class Node;
     
    4946
    5047    HitTestResult();
    51     HitTestResult(const IntPoint&);
     48    HitTestResult(const LayoutPoint&);
    5249    // Pass non-negative padding values to perform a rect-based hit test.
    53     HitTestResult(const IntPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
     50    HitTestResult(const LayoutPoint& centerPoint, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
    5451    HitTestResult(const HitTestResult&);
    5552    ~HitTestResult();
     
    5855    Node* innerNode() const { return m_innerNode.get(); }
    5956    Node* innerNonSharedNode() const { return m_innerNonSharedNode.get(); }
    60     IntPoint point() const { return m_point; }
    61     IntPoint localPoint() const { return m_localPoint; }
     57    LayoutPoint point() const { return m_point; }
     58    LayoutPoint localPoint() const { return m_localPoint; }
    6259    Element* URLElement() const { return m_innerURLElement.get(); }
    6360    Scrollbar* scrollbar() const { return m_scrollbar.get(); }
     
    6865    void setInnerNode(Node*);
    6966    void setInnerNonSharedNode(Node*);
    70     void setPoint(const IntPoint& p) { m_point = p; }
    71     void setLocalPoint(const IntPoint& p) { m_localPoint = p; }
     67    void setPoint(const LayoutPoint& p) { m_point = p; }
     68    void setLocalPoint(const LayoutPoint& p) { m_localPoint = p; }
    7269    void setURLElement(Element*);
    7370    void setScrollbar(Scrollbar*);
     
    104101    // Rect-based hit test related methods.
    105102    bool isRectBasedTest() const { return m_isRectBased; }
    106     IntRect rectForPoint(const IntPoint&) const;
    107     static IntRect rectForPoint(const IntPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
     103    LayoutRect rectForPoint(const LayoutPoint&) const;
     104    static LayoutRect rectForPoint(const LayoutPoint&, unsigned topPadding, unsigned rightPadding, unsigned bottomPadding, unsigned leftPadding);
    108105    int topPadding() const { return m_topPadding; }
    109106    int rightPadding() const { return m_rightPadding; }
     
    113110    // Returns true if it is rect-based hit test and needs to continue until the rect is fully
    114111    // enclosed by the boundaries of a node.
    115     bool addNodeToRectBasedTestResult(Node*, const IntPoint& pointInContainer, const IntRect& = IntRect());
    116     bool addNodeToRectBasedTestResult(Node*, const IntPoint& pointInContainer, const FloatRect&);
     112    bool addNodeToRectBasedTestResult(Node*, const LayoutPoint& pointInContainer, const LayoutRect& = IntRect());
     113    bool addNodeToRectBasedTestResult(Node*, const LayoutPoint& pointInContainer, const FloatRect&);
    117114    void append(const HitTestResult&);
    118115
     
    131128    RefPtr<Node> m_innerNode;
    132129    RefPtr<Node> m_innerNonSharedNode;
    133     IntPoint m_point;
    134     IntPoint m_localPoint; // A point in the local coordinate space of m_innerNonSharedNode's renderer. Allows us to efficiently
    135                            // determine where inside the renderer we hit on subsequent operations.
     130    LayoutPoint m_point;
     131    LayoutPoint m_localPoint; // A point in the local coordinate space of m_innerNonSharedNode's renderer. Allows us to efficiently
     132                              // determine where inside the renderer we hit on subsequent operations.
    136133    RefPtr<Element> m_innerURLElement;
    137134    RefPtr<Scrollbar> m_scrollbar;
     
    150147// width = leftPadding + rightPadding + 1
    151148// height = topPadding + bottomPadding + 1
    152 inline IntRect HitTestResult::rectForPoint(const IntPoint& point) const
     149inline LayoutRect HitTestResult::rectForPoint(const LayoutPoint& point) const
    153150{
    154151    return rectForPoint(point, m_topPadding, m_rightPadding, m_bottomPadding, m_leftPadding);
Note: See TracChangeset for help on using the changeset viewer.