Title: [112361] trunk/Source/WebKit/blackberry
Revision
112361
Author
[email protected]
Date
2012-03-27 20:47:00 -0700 (Tue, 27 Mar 2012)

Log Message

[BlackBerry] Text selection - selection gets broken in test.com/individuals.htm
https://bugs.webkit.org/show_bug.cgi?id=82292

Change to check and avoid text selection across frames.

Internal reviewed by Mike Fenton

Patch by Sean Wang <[email protected]> on 2012-03-27
Reviewed by Rob Buis.

* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::visiblePositionForPointIgnoringClipping):
    support selection across frames, so check if the *framePoint* is in
    the *frame*.
(BlackBerry::WebKit::SelectionHandler::setSelection):
    function returns a null VisablePosition, it stands for a invalid position
    or a position in the different frames, therefor we don't execute setting
    handle's position.

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (112360 => 112361)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-03-28 03:15:57 UTC (rev 112360)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-03-28 03:47:00 UTC (rev 112361)
@@ -1,3 +1,23 @@
+2012-03-27  Sean Wang  <[email protected]>
+
+        [BlackBerry] Text selection - selection gets broken in test.com/individuals.htm
+        https://bugs.webkit.org/show_bug.cgi?id=82292
+
+        Change to check and avoid text selection across frames.
+
+        Internal reviewed by Mike Fenton
+
+        Reviewed by Rob Buis.
+
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::visiblePositionForPointIgnoringClipping):
+            support selection across frames, so check if the *framePoint* is in
+            the *frame*.
+        (BlackBerry::WebKit::SelectionHandler::setSelection):
+            function returns a null VisablePosition, it stands for a invalid position
+            or a position in the different frames, therefor we don't execute setting
+            handle's position.
+
 2012-03-27  Andrew Lo  <[email protected]>
 
         [BlackBerry] Switch WebPageCompositor to use AnimationFrameRateController instead of timer

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (112360 => 112361)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-03-28 03:15:57 UTC (rev 112360)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-03-28 03:47:00 UTC (rev 112361)
@@ -138,7 +138,7 @@
     HitTestResult result = frame.eventHandler()->hitTestResultAtPoint(framePoint, true /* allowShadowContent */, true /* ignoreClipping */);
 
     Node* node = result.innerNode();
-    if (!node)
+    if (!node || node->document() != frame.document())
         return VisiblePosition();
 
     RenderObject* renderer = node->renderer();
@@ -450,24 +450,31 @@
     if (!controller->selection().isBaseFirst())
         controller->setSelection(VisibleSelection(controller->selection().start(), controller->selection().end(), true /* isDirectional */));
 
+    // We don't return early in the following, so that we can do input field scrolling if the
+    // handle is outside the bounds of the field. This can be extended to handle sub-region
+    // scrolling as well
     if (startIsValid) {
         relativeStart = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), focusedFrame, start);
 
-        // Set the selection with validation.
-        newSelection.setBase(visiblePositionForPointIgnoringClipping(*focusedFrame, clipPointToVisibleContainer(start)));
-
-        // Reset the selection using the existing extent without validation.
-        newSelection.setWithoutValidation(newSelection.base(), controller->selection().end());
+        VisiblePosition base = visiblePositionForPointIgnoringClipping(*focusedFrame, clipPointToVisibleContainer(start));
+        if (base.isNotNull()) {
+            // The function setBase validates the "base"
+            newSelection.setBase(base);
+            newSelection.setWithoutValidation(newSelection.base(), controller->selection().end());
+            // Don't return early.
+        }
     }
 
     if (m_lastUpdatedEndPointIsValid) {
         relativeEnd = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), focusedFrame, end);
 
-        // Set the selection with validation.
-        newSelection.setExtent(visiblePositionForPointIgnoringClipping(*focusedFrame, clipPointToVisibleContainer(end)));
-
-        // Reset the selection using the existing base without validation.
-        newSelection.setWithoutValidation(controller->selection().start(), newSelection.extent());
+        VisiblePosition extent = visiblePositionForPointIgnoringClipping(*focusedFrame, clipPointToVisibleContainer(end));
+        if (extent.isNotNull()) {
+            // The function setExtent validates the "extent"
+            newSelection.setExtent(extent);
+            newSelection.setWithoutValidation(controller->selection().start(), newSelection.extent());
+            // Don't return early.
+        }
     }
 
     newSelection.setIsDirectional(true);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to