Title: [134624] trunk/Source/WebKit/blackberry
Revision
134624
Author
[email protected]
Date
2012-11-14 10:37:56 -0800 (Wed, 14 Nov 2012)

Log Message

[BlackBerry] Add FocusBased context node detection strategy
https://bugs.webkit.org/show_bug.cgi?id=102238

Patch by Andy Chen <[email protected]> on 2012-11-14
Reviewed by Rob Buis.

If last fat finger result is invalid, we need to return current
focus element as context node, because when user tap on selection
overlay, there is not touch event sent to webkit.
PR 241382

Internally reviewed by Genevieve Mak and Mike Fenton.

* Api/WebPage.cpp:
(BlackBerry::WebKit::WebPagePrivate::contextNode):
* Api/WebPage.h:
* WebKitSupport/InputHandler.h:
(BlackBerry::WebKit::InputHandler::currentFocusElement):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.cpp (134623 => 134624)


--- trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-11-14 18:20:52 UTC (rev 134623)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.cpp	2012-11-14 18:37:56 UTC (rev 134624)
@@ -2640,17 +2640,19 @@
     if (isTouching && lastFatFingersResult.isTextInput())
         return lastFatFingersResult.node(FatFingersResult::ShadowContentNotAllowed);
 
+    if (strategy == RectBased) {
+        FatFingersResult result = FatFingers(this, lastFatFingersResult.adjustedPosition(), FatFingers::Text).findBestPoint();
+        return result.node(FatFingersResult::ShadowContentNotAllowed);
+    }
+    if (strategy == FocusBased)
+        return m_inputHandler->currentFocusElement();
+
     IntPoint contentPos;
     if (isTouching)
         contentPos = lastFatFingersResult.adjustedPosition();
     else
         contentPos = mapFromViewportToContents(m_lastMouseEvent.position());
 
-    if (strategy == RectBased) {
-        FatFingersResult result = FatFingers(this, lastFatFingersResult.adjustedPosition(), FatFingers::Text).findBestPoint();
-        return result.node(FatFingersResult::ShadowContentNotAllowed);
-    }
-
     HitTestResult result = eventHandler->hitTestResultAtPoint(contentPos, false /*allowShadowContent*/);
     return result.innerNode();
 }

Modified: trunk/Source/WebKit/blackberry/Api/WebPage.h (134623 => 134624)


--- trunk/Source/WebKit/blackberry/Api/WebPage.h	2012-11-14 18:20:52 UTC (rev 134623)
+++ trunk/Source/WebKit/blackberry/Api/WebPage.h	2012-11-14 18:37:56 UTC (rev 134624)
@@ -82,7 +82,7 @@
 
 enum ActivationStateType { ActivationActive, ActivationInactive, ActivationStandby };
 
-enum TargetDetectionStrategy {PointBased, RectBased};
+enum TargetDetectionStrategy {PointBased, RectBased, FocusBased};
 
 class BLACKBERRY_EXPORT WebPage : public Platform::GuardedPointerBase {
 public:

Modified: trunk/Source/WebKit/blackberry/ChangeLog (134623 => 134624)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-11-14 18:20:52 UTC (rev 134623)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-11-14 18:37:56 UTC (rev 134624)
@@ -1,3 +1,23 @@
+2012-11-14  Andy Chen  <[email protected]>
+
+        [BlackBerry] Add FocusBased context node detection strategy
+        https://bugs.webkit.org/show_bug.cgi?id=102238
+
+        Reviewed by Rob Buis.
+
+        If last fat finger result is invalid, we need to return current
+        focus element as context node, because when user tap on selection
+        overlay, there is not touch event sent to webkit.
+        PR 241382
+
+        Internally reviewed by Genevieve Mak and Mike Fenton.
+
+        * Api/WebPage.cpp:
+        (BlackBerry::WebKit::WebPagePrivate::contextNode):
+        * Api/WebPage.h:
+        * WebKitSupport/InputHandler.h:
+        (BlackBerry::WebKit::InputHandler::currentFocusElement):
+
 2012-11-14  Nima Ghanavatian  <[email protected]>
 
         [BlackBerry] Use mispelled-marker offsets relative to the element

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h (134623 => 134624)


--- trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2012-11-14 18:20:52 UTC (rev 134623)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/InputHandler.h	2012-11-14 18:37:56 UTC (rev 134624)
@@ -101,6 +101,7 @@
 
     bool isInputMode() const { return isActiveTextEdit(); }
     bool isMultilineInputMode() const { return isActiveTextEdit() && elementType(m_currentFocusElement.get()) == BlackBerry::Platform::InputTypeTextArea; }
+    PassRefPtr<WebCore::Element> currentFocusElement() const { return m_currentFocusElement; }
 
     void ensureFocusElementVisible(bool centerFieldInDisplay = true);
     void handleInputLocaleChanged(bool isRTL);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to