Title: [117638] trunk/Source/WebKit/blackberry
Revision
117638
Author
[email protected]
Date
2012-05-18 14:50:47 -0700 (Fri, 18 May 2012)

Log Message

[BlackBerry] Validation of Last Fat Finger result is needed for selection.
https://bugs.webkit.org/show_bug.cgi?id=86888

Reviewed by Antonio Gomes.

PR 128393.

Cached FatFingersResults must be validatible against
the desired request to ensure the result is both for
the same point and of the same type.

* WebKitSupport/FatFingers.h:
(WebKit):
(FatFingersResult):
(BlackBerry::WebKit::FatFingersResult::FatFingersResult):
(BlackBerry::WebKit::FatFingersResult::reset):
(BlackBerry::WebKit::FatFingersResult::resultMatches):
(BlackBerry::WebKit::FatFingersResult::originPosition):
(BlackBerry::WebKit::FatFingersResult::adjustedPosition):
(BlackBerry::WebKit::FatFingersResult::positionWasAdjusted):
(BlackBerry::WebKit::FatFingersResult::isTextInput):
(BlackBerry::WebKit::FatFingersResult::isValid):
(BlackBerry::WebKit::FatFingersResult::node):
(BlackBerry::WebKit::FatFingersResult::nodeAsElementIfApplicable):
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::selectAtPoint):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (117637 => 117638)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-05-18 21:49:37 UTC (rev 117637)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-05-18 21:50:47 UTC (rev 117638)
@@ -1,3 +1,32 @@
+2012-05-18  Mike Fenton  <[email protected]>
+
+        [BlackBerry] Validation of Last Fat Finger result is needed for selection.
+        https://bugs.webkit.org/show_bug.cgi?id=86888
+
+        Reviewed by Antonio Gomes.
+
+        PR 128393.
+
+        Cached FatFingersResults must be validatible against
+        the desired request to ensure the result is both for
+        the same point and of the same type.
+
+        * WebKitSupport/FatFingers.h:
+        (WebKit):
+        (FatFingersResult):
+        (BlackBerry::WebKit::FatFingersResult::FatFingersResult):
+        (BlackBerry::WebKit::FatFingersResult::reset):
+        (BlackBerry::WebKit::FatFingersResult::resultMatches):
+        (BlackBerry::WebKit::FatFingersResult::originPosition):
+        (BlackBerry::WebKit::FatFingersResult::adjustedPosition):
+        (BlackBerry::WebKit::FatFingersResult::positionWasAdjusted):
+        (BlackBerry::WebKit::FatFingersResult::isTextInput):
+        (BlackBerry::WebKit::FatFingersResult::isValid):
+        (BlackBerry::WebKit::FatFingersResult::node):
+        (BlackBerry::WebKit::FatFingersResult::nodeAsElementIfApplicable):
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::selectAtPoint):
+
 2012-05-18  MORITA Hajime  <[email protected]>
 
         https://bugs.webkit.org/show_bug.cgi?id=85515

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;
-};
-
 }
 }
 

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (117637 => 117638)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-05-18 21:49:37 UTC (rev 117637)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-05-18 21:50:47 UTC (rev 117638)
@@ -554,7 +554,7 @@
     WebCore::IntPoint targetPosition;
     // FIXME: Factory this get right fat finger code into a helper.
     const FatFingersResult lastFatFingersResult = m_webPage->m_touchEventHandler->lastFatFingersResult();
-    if (lastFatFingersResult.positionWasAdjusted() && lastFatFingersResult.nodeAsElementIfApplicable()) {
+    if (lastFatFingersResult.resultMatches(location, FatFingers::Text) && lastFatFingersResult.positionWasAdjusted() && lastFatFingersResult.nodeAsElementIfApplicable()) {
         targetNode = lastFatFingersResult.node(FatFingersResult::ShadowContentNotAllowed);
         targetPosition = lastFatFingersResult.adjustedPosition();
     } else {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to