Title: [147189] trunk/Source/WebKit/blackberry
Revision
147189
Author
commit-qu...@webkit.org
Date
2013-03-28 18:01:01 -0700 (Thu, 28 Mar 2013)

Log Message

[BlackBerry] Don't cross editing boundary when touch hold selection expands
https://bugs.webkit.org/show_bug.cgi?id=113537

Patch by Iris Wu <sh...@blackberry.com> on 2013-03-28
Reviewed by Rob Buis.

Set editing boundary crossing rule to make sure it won't cross
editing boundary when selection expands.

Reviewed Internally By Genevieve Mak and Mike Fenton.

* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::selectNextParagraph):
(BlackBerry::WebKit::SelectionHandler::findNextAnimationOverlayRegion):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (147188 => 147189)


--- trunk/Source/WebKit/blackberry/ChangeLog	2013-03-29 00:51:05 UTC (rev 147188)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2013-03-29 01:01:01 UTC (rev 147189)
@@ -1,3 +1,19 @@
+2013-03-28  Iris Wu  <sh...@blackberry.com>
+
+        [BlackBerry] Don't cross editing boundary when touch hold selection expands
+        https://bugs.webkit.org/show_bug.cgi?id=113537
+
+        Reviewed by Rob Buis.
+
+        Set editing boundary crossing rule to make sure it won't cross
+        editing boundary when selection expands.
+
+        Reviewed Internally By Genevieve Mak and Mike Fenton.
+
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::SelectionHandler::selectNextParagraph):
+        (BlackBerry::WebKit::SelectionHandler::findNextAnimationOverlayRegion):
+
 2013-03-28  Jakob Petsovits  <jpetsov...@blackberry.com>
 
         [BlackBerry] Don't use WebKit thread scale information in WebPageCompositor.

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (147188 => 147189)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2013-03-29 00:51:05 UTC (rev 147188)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2013-03-29 01:01:01 UTC (rev 147189)
@@ -674,11 +674,6 @@
     selectObject(targetPosition, textGranularityFromSelectionExpansionType(selectionExpansionType));
 }
 
-static bool isInvalidLine(const VisiblePosition& pos)
-{
-    return endOfLine(pos).isNull() || pos == endOfLine(pos) || !inSameLine(pos, endOfLine(pos));
-}
-
 static bool isInvalidParagraph(const VisiblePosition& pos)
 {
     return endOfParagraph(pos).isNull() || pos == endOfParagraph(pos);
@@ -689,14 +684,14 @@
     FrameSelection* controller = m_webPage->focusedOrMainFrame()->selection();
 
     VisiblePosition startPos = VisiblePosition(controller->start(), controller->affinity());
-    if (isStartOfLine(startPos) && isEndOfEditableOrNonEditableContent(startPos))
-        startPos = startPos.previous();
+    if (isStartOfLine(startPos) && isEndOfDocument(startPos))
+        startPos = startPos.previous(CannotCrossEditingBoundary);
 
     // Find next paragraph end position.
     VisiblePosition endPos(controller->end(), controller->affinity()); // endPos here indicates the end of current paragraph
-    endPos = endPos.next(); // find the start of next paragraph
-    while (!isEndOfDocument(endPos.deepEquivalent()) && endPos.isNotNull() && isInvalidParagraph(endPos))
-        endPos = endPos.next(); // go to next position
+    endPos = endPos.next(CannotCrossEditingBoundary); // find the start of next paragraph
+    while (!isEndOfDocument(endPos) && endPos.isNotNull() && isInvalidParagraph(endPos))
+        endPos = endPos.next(CannotCrossEditingBoundary); // go to next position
     endPos = endOfParagraph(endPos); // find the end of paragraph
 
     // Set selection if the paragraph is covered by overlay and endPos is not null.
@@ -706,7 +701,7 @@
         controller->setSelection(selection);
 
         // Stop expansion if reaching the end of page.
-        if (isEndOfDocument(endPos.deepEquivalent()))
+        if (isEndOfDocument(endPos))
             m_webPage->m_client->stopExpandingSelection();
     }
 }
@@ -741,13 +736,13 @@
 bool SelectionHandler::findNextAnimationOverlayRegion()
 {
     // If overlay is at the end of document, stop overlay expansion.
-    if (isEndOfDocument(m_animationOverlayEndPos.deepEquivalent()) || m_animationOverlayEndPos.isNull())
+    if (isEndOfDocument(m_animationOverlayEndPos) || m_animationOverlayEndPos.isNull())
         return false;
 
-    m_animationOverlayEndPos = m_animationOverlayEndPos.next();
-    while (!isEndOfDocument(m_animationOverlayEndPos.deepEquivalent()) && m_animationOverlayEndPos.isNotNull() && isInvalidLine(m_animationOverlayEndPos))
-        m_animationOverlayEndPos = m_animationOverlayEndPos.next(); // go to next position
-    m_animationOverlayEndPos = endOfLine(m_animationOverlayEndPos); // find end of line
+    m_animationOverlayEndPos = m_animationOverlayEndPos.next(CannotCrossEditingBoundary);
+    while (!isEndOfDocument(m_animationOverlayEndPos) && m_animationOverlayEndPos.isNotNull() && isInvalidParagraph(m_animationOverlayEndPos))
+        m_animationOverlayEndPos = m_animationOverlayEndPos.next(CannotCrossEditingBoundary); // go to next position
+    m_animationOverlayEndPos = endOfParagraph(m_animationOverlayEndPos); // find end of paragraph
 
     VisibleSelection selection(m_animationOverlayStartPos, m_animationOverlayEndPos);
     m_nextAnimationOverlayRegion = regionForSelectionQuads(selection);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to