Title: [135422] trunk/Source/WebKit/blackberry
Revision
135422
Author
mifen...@rim.com
Date
2012-11-21 11:52:47 -0800 (Wed, 21 Nov 2012)

Log Message

[BlackBerry] Switch to point instead of VisiblePosition comparison for input bounds check
https://bugs.webkit.org/show_bug.cgi?id=102962

Reviewed by Rob Buis.

PR 247270.

Switch from using VisiblePosition to determine if we are in a node
to a comparison of the field bounds.  This fixes the case where
there is no node before the target node to match.

Reviewed Internally by Gen Mak.

* WebKitSupport/DOMSupport.cpp:
* WebKitSupport/DOMSupport.h:
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::setCaretPosition):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (135421 => 135422)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-11-21 19:05:17 UTC (rev 135421)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-11-21 19:52:47 UTC (rev 135422)
@@ -1,3 +1,23 @@
+2012-11-21  Mike Fenton  <mifen...@rim.com>
+
+        [BlackBerry] Switch to point instead of VisiblePosition comparison for input bounds check
+        https://bugs.webkit.org/show_bug.cgi?id=102962
+
+        Reviewed by Rob Buis.
+
+        PR 247270.
+
+        Switch from using VisiblePosition to determine if we are in a node
+        to a comparison of the field bounds.  This fixes the case where
+        there is no node before the target node to match.
+
+        Reviewed Internally by Gen Mak.
+
+        * WebKitSupport/DOMSupport.cpp:
+        * WebKitSupport/DOMSupport.h:
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::setCaretPosition):
+
 2012-11-20  Andrew Lo  <a...@rim.com>
 
         [BlackBerry] Animated gifs pause on scroll or zoom and sometimes don't resume after scroll or zoom completes

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp (135421 => 135422)


--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp	2012-11-21 19:05:17 UTC (rev 135421)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp	2012-11-21 19:52:47 UTC (rev 135422)
@@ -314,34 +314,6 @@
     return VisibleSelection(visibleStart, visibleEnd);
 }
 
-Node* DOMContainerNodeForPosition(const Position& position)
-{
-    Node* nodeAtPos = position.containerNode();
-    if (nodeAtPos && nodeAtPos->isInShadowTree())
-        nodeAtPos = nodeAtPos->shadowAncestorNode();
-
-    return nodeAtPos;
-}
-
-bool isPositionInNode(Node* node, const Position& position)
-{
-    if (!node)
-        return false;
-
-    Node* domNodeAtPos = DOMContainerNodeForPosition(position);
-    if (!domNodeAtPos)
-        return false;
-
-    int offset = 0;
-    if (domNodeAtPos == position.containerNode())
-        offset = position.computeOffsetInContainerNode();
-
-    RefPtr<Range> rangeForNode = rangeOfContents(node);
-    int ec;
-
-    return rangeForNode->isPointInRange(domNodeAtPos, offset, ec);
-}
-
 static bool matchesReservedStringEmail(const AtomicString& string)
 {
     return string.contains("email", false /* caseSensitive */);

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h (135421 => 135422)


--- trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h	2012-11-21 19:05:17 UTC (rev 135421)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h	2012-11-21 19:52:47 UTC (rev 135422)
@@ -76,9 +76,6 @@
 WebCore::VisibleSelection visibleSelectionForRangeInputElement(WebCore::Element*, int start, int end);
 WebCore::VisibleSelection visibleSelectionForInputElement(WebCore::Element*);
 
-WebCore::Node* DOMContainerNodeForPosition(const WebCore::Position&);
-bool isPositionInNode(WebCore::Node*, const WebCore::Position&);
-
 bool elementIdOrNameIndicatesNoAutocomplete(const WebCore::Element*);
 bool elementIdOrNameIndicatesEmail(const WebCore::HTMLInputElement*);
 bool elementIdOrNameIndicatesUrl(const WebCore::HTMLInputElement*);

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (135421 => 135422)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-11-21 19:05:17 UTC (rev 135421)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-11-21 19:52:47 UTC (rev 135422)
@@ -253,14 +253,17 @@
 
     VisiblePosition visibleCaretPosition(focusedFrame->visiblePositionForPoint(relativePoint));
 
-    if (!DOMSupport::isPositionInNode(m_webPage->focusedOrMainFrame()->document()->focusedNode(), visibleCaretPosition.deepEquivalent())) {
-        if (unsigned short character = directionOfPointRelativeToRect(relativePoint, currentCaretRect))
-            m_webPage->m_inputHandler->handleKeyboardInput(Platform::KeyboardEvent(character));
+    if (RenderObject* focusedRenderer = focusedFrame->document()->focusedNode()->renderer()) {
+        WebCore::IntRect nodeOutlineBounds(focusedRenderer->absoluteOutlineBounds());
+        if (!nodeOutlineBounds.contains(relativePoint)) {
+            if (unsigned short character = directionOfPointRelativeToRect(relativePoint, currentCaretRect))
+                m_webPage->m_inputHandler->handleKeyboardInput(Platform::KeyboardEvent(character));
 
-        // Send the selection changed in case this does not trigger a selection change to
-        // ensure the caret position is accurate. This may be a duplicate event.
-        selectionPositionChanged(true /* forceUpdateWithoutChange */);
-        return;
+            // Send the selection changed in case this does not trigger a selection change to
+            // ensure the caret position is accurate. This may be a duplicate event.
+            selectionPositionChanged(true /* forceUpdateWithoutChange */);
+            return;
+        }
     }
 
     VisibleSelection newSelection(visibleCaretPosition);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to