Modified: trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.h (117637 => 117638)
--- trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.h 2012-05-18 21:49:37 UTC (rev 117637)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/FatFingers.h 2012-05-18 21:50:47 UTC (rev 117638)
@@ -45,15 +45,84 @@
namespace WebKit {
class WebPagePrivate;
-class FatFingers;
+class FatFingersResult;
class TouchEventHandler;
+
+class FatFingers {
+public:
+ enum TargetType { ClickableElement, Text };
+
+ FatFingers(WebPagePrivate* webpage, const WebCore::IntPoint& contentPos, TargetType);
+ ~FatFingers();
+
+ const FatFingersResult findBestPoint();
+
+#if DEBUG_FAT_FINGERS
+ // These debug vars are all in content coordinates. They are public so
+ // they can be read from BackingStore, which will draw a visible rect
+ // around the fat fingers area.
+ static WebCore::IntRect m_debugFatFingerRect;
+ static WebCore::IntPoint m_debugFatFingerClickPosition;
+ static WebCore::IntPoint m_debugFatFingerAdjustedPosition;
+#endif
+
+private:
+ enum MatchingApproachForClickable { ClickableByDefault = 0, MadeClickableByTheWebpage, Done };
+
+ typedef std::pair<WebCore::Node*, Platform::IntRectRegion> IntersectingRegion;
+
+ enum CachedResultsStrategy { GetFromRenderTree = 0, GetFromCache };
+ CachedResultsStrategy cachingStrategy() const;
+ typedef HashMap<RefPtr<WebCore::Document>, ListHashSet<RefPtr<WebCore::Node> > > CachedRectHitTestResults;
+
+ bool checkFingerIntersection(const Platform::IntRectRegion&,
+ const Platform::IntRectRegion& remainingFingerRegion,
+ WebCore::Node*,
+ Vector<IntersectingRegion>& intersectingRegions);
+
+ bool findIntersectingRegions(WebCore::Document*,
+ Vector<IntersectingRegion>& intersectingRegions,
+ Platform::IntRectRegion& remainingFingerRegion);
+
+ bool checkForClickableElement(WebCore::Element*,
+ Vector<IntersectingRegion>& intersectingRegions,
+ Platform::IntRectRegion& remainingFingerRegion,
+ WebCore::RenderLayer*& lowestPositionedEnclosingLayerSoFar);
+
+ bool checkForText(WebCore::Node*,
+ Vector<IntersectingRegion>& intersectingRegions,
+ Platform::IntRectRegion& fingerRegion);
+
+ void setSuccessfulFatFingersResult(FatFingersResult&, WebCore::Node*, const WebCore::IntPoint&);
+
+ void getNodesFromRect(WebCore::Document*, const WebCore::IntPoint&, ListHashSet<RefPtr<WebCore::Node> >&);
+
+ // It mimics Document::elementFromPoint, but recursively hit-tests in case an inner frame is found.
+ void getRelevantInfoFromPoint(WebCore::Document*,
+ const WebCore::IntPoint&,
+ WebCore::Element*& elementUnderPoint,
+ WebCore::Element*& clickableElementUnderPoint) const;
+
+ bool isElementClickable(WebCore::Element*) const;
+
+ inline WebCore::IntRect fingerRectForPoint(const WebCore::IntPoint&) const;
+ void getPaddings(unsigned& top, unsigned& right, unsigned& bottom, unsigned& left) const;
+
+ WebPagePrivate* m_webPage;
+ WebCore::IntPoint m_contentPos;
+ TargetType m_targetType;
+ MatchingApproachForClickable m_matchingApproach;
+ CachedRectHitTestResults m_cachedRectHitTestResults;
+};
+
class FatFingersResult {
public:
- FatFingersResult(const WebCore::IntPoint& p = WebCore::IntPoint::zero())
+ FatFingersResult(const WebCore::IntPoint& p = WebCore::IntPoint::zero(), const FatFingers::TargetType targetType = FatFingers::ClickableElement)
: m_originalPosition(p)
, m_adjustedPosition(p)
+ , m_targetType(targetType)
, m_positionWasAdjusted(false)
, m_isTextInput(false)
, m_isValid(false)
@@ -70,6 +139,11 @@
m_nodeUnderFatFinger = 0;
}
+ bool resultMatches(const WebCore::IntPoint& p, const FatFingers::TargetType targetType) const
+ {
+ return m_isValid && p == m_originalPosition && targetType == m_targetType;
+ }
+
WebCore::IntPoint originPosition() const { return m_originalPosition; }
WebCore::IntPoint adjustedPosition() const { return m_adjustedPosition; }
bool positionWasAdjusted() const { return m_isValid && m_positionWasAdjusted; }
@@ -110,6 +184,7 @@
WebCore::IntPoint m_originalPosition; // Main frame contents coordinates.
WebCore::IntPoint m_adjustedPosition; // Main frame contents coordinates.
+ FatFingers::TargetType m_targetType;
bool m_positionWasAdjusted;
bool m_isTextInput; // Check if the element under the touch point will require a VKB be displayed so that
// the touch down can be suppressed.
@@ -117,73 +192,6 @@
RefPtr<WebCore::Node> m_nodeUnderFatFinger;
};
-class FatFingers {
-public:
- enum TargetType { ClickableElement, Text };
-
- FatFingers(WebPagePrivate* webpage, const WebCore::IntPoint& contentPos, TargetType);
- ~FatFingers();
-
- const FatFingersResult findBestPoint();
-
-#if DEBUG_FAT_FINGERS
- // These debug vars are all in content coordinates. They are public so
- // they can be read from BackingStore, which will draw a visible rect
- // around the fat fingers area.
- static WebCore::IntRect m_debugFatFingerRect;
- static WebCore::IntPoint m_debugFatFingerClickPosition;
- static WebCore::IntPoint m_debugFatFingerAdjustedPosition;
-#endif
-
-private:
- enum MatchingApproachForClickable { ClickableByDefault = 0, MadeClickableByTheWebpage, Done };
-
- typedef std::pair<WebCore::Node*, Platform::IntRectRegion> IntersectingRegion;
-
- enum CachedResultsStrategy { GetFromRenderTree = 0, GetFromCache };
- CachedResultsStrategy cachingStrategy() const;
- typedef HashMap<RefPtr<WebCore::Document>, ListHashSet<RefPtr<WebCore::Node> > > CachedRectHitTestResults;
-
- bool checkFingerIntersection(const Platform::IntRectRegion&,
- const Platform::IntRectRegion& remainingFingerRegion,
- WebCore::Node*,
- Vector<IntersectingRegion>& intersectingRegions);
-
- bool findIntersectingRegions(WebCore::Document*,
- Vector<IntersectingRegion>& intersectingRegions,
- Platform::IntRectRegion& remainingFingerRegion);
-
- bool checkForClickableElement(WebCore::Element*,
- Vector<IntersectingRegion>& intersectingRegions,
- Platform::IntRectRegion& remainingFingerRegion,
- WebCore::RenderLayer*& lowestPositionedEnclosingLayerSoFar);
-
- bool checkForText(WebCore::Node*,
- Vector<IntersectingRegion>& intersectingRegions,
- Platform::IntRectRegion& fingerRegion);
-
- void setSuccessfulFatFingersResult(FatFingersResult&, WebCore::Node*, const WebCore::IntPoint&);
-
- void getNodesFromRect(WebCore::Document*, const WebCore::IntPoint&, ListHashSet<RefPtr<WebCore::Node> >&);
-
- // It mimics Document::elementFromPoint, but recursively hit-tests in case an inner frame is found.
- void getRelevantInfoFromPoint(WebCore::Document*,
- const WebCore::IntPoint&,
- WebCore::Element*& elementUnderPoint,
- WebCore::Element*& clickableElementUnderPoint) const;
-
- bool isElementClickable(WebCore::Element*) const;
-
- inline WebCore::IntRect fingerRectForPoint(const WebCore::IntPoint&) const;
- void getPaddings(unsigned& top, unsigned& right, unsigned& bottom, unsigned& left) const;
-
- WebPagePrivate* m_webPage;
- WebCore::IntPoint m_contentPos;
- TargetType m_targetType;
- MatchingApproachForClickable m_matchingApproach;
- CachedRectHitTestResults m_cachedRectHitTestResults;
-};
-
}
}