Title: [127894] trunk/Source/WebKit/blackberry
Revision
127894
Author
commit-qu...@webkit.org
Date
2012-09-07 11:11:17 -0700 (Fri, 07 Sep 2012)

Log Message

[BlackBerry] Initialize caret rectangle with invalid location
https://bugs.webkit.org/show_bug.cgi?id=96011

Patch by Yongxin Dai <yo...@rim.com> on 2012-09-07
Reviewed by Rob Buis.

In SelectionHandler::selectionPositionChanged() method, startCaret and
endCaret are used to notify clients about new caret positions. This patch
initializes startCaret and endCaret with location(-1. -1), and keeps them
empty before they are assigned to valid values. This would help for other
classes to check validity of the caret correctly.

Internal reviewed by Mike Fenton.

* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::adjustCaretRects):
(BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):

Modified Paths

Diff

Modified: trunk/Source/WebKit/blackberry/ChangeLog (127893 => 127894)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-09-07 18:09:45 UTC (rev 127893)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-09-07 18:11:17 UTC (rev 127894)
@@ -1,3 +1,22 @@
+2012-09-07  Yongxin Dai  <yo...@rim.com>
+
+        [BlackBerry] Initialize caret rectangle with invalid location
+        https://bugs.webkit.org/show_bug.cgi?id=96011
+
+        Reviewed by Rob Buis.
+
+        In SelectionHandler::selectionPositionChanged() method, startCaret and
+        endCaret are used to notify clients about new caret positions. This patch
+        initializes startCaret and endCaret with location(-1. -1), and keeps them
+        empty before they are assigned to valid values. This would help for other
+        classes to check validity of the caret correctly.
+
+        Internal reviewed by Mike Fenton.
+
+        * WebKitSupport/SelectionHandler.cpp:
+        (BlackBerry::WebKit::adjustCaretRects):
+        (BlackBerry::WebKit::SelectionHandler::selectionPositionChanged):
+
 2012-09-07  Lianghui Chen  <liac...@rim.com>
 
         [BlackBerry] when one of multiple tabs uses authentication, user can get the auth dialog while the other tab has focus.

Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (127893 => 127894)


--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-09-07 18:09:45 UTC (rev 127893)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp	2012-09-07 18:11:17 UTC (rev 127894)
@@ -738,6 +738,8 @@
     else {
         startCaret = rectList[0];
         startCaret.setLocation(caretLocationForRect(startCaret, true, isRTL));
+        // Reset width to 1 as we are strictly interested in caret location.
+        startCaret.setWidth(1);
     }
 
     if (isEndCaretClippedOut)
@@ -745,15 +747,13 @@
     else {
         endCaret = rectList[0];
         endCaret.setLocation(caretLocationForRect(endCaret, false, isRTL));
+        // Reset width to 1 as we are strictly interested in caret location.
+        endCaret.setWidth(1);
     }
 
     if (isStartCaretClippedOut && isEndCaretClippedOut)
         return;
 
-    // Reset width to 1 as we are strictly interested in caret location.
-    startCaret.setWidth(1);
-    endCaret.setWidth(1);
-
     for (unsigned i = 1; i < rectList.size(); i++) {
         WebCore::IntRect currentRect(rectList[i]);
 
@@ -874,8 +874,8 @@
 
     SelectionTimingLog(LogLevelInfo, "SelectionHandler::selectionPositionChanged starting at %f", m_timer.elapsed());
 
-    WebCore::IntRect startCaret;
-    WebCore::IntRect endCaret;
+    WebCore::IntRect startCaret(DOMSupport::InvalidPoint, WebCore::IntSize());
+    WebCore::IntRect endCaret(DOMSupport::InvalidPoint, WebCore::IntSize());
 
     // Get the text rects from the selections range.
     Vector<FloatQuad> quads;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to