Title: [147467] trunk/Source/WebKit/blackberry
- Revision
- 147467
- Author
- [email protected]
- Date
- 2013-04-02 11:17:10 -0700 (Tue, 02 Apr 2013)
Log Message
[BlackBerry] Create a selection from two points irregardless of the caret position.
https://bugs.webkit.org/show_bug.cgi?id=113795
Patch by Nima Ghanavatian <[email protected]> on 2013-04-02
Reviewed by Rob Buis.
Internally reviewed by Mike Fenton.
PR276577
If we are to set both the base and extent of a selection, we should maintain the base upon setting the extent.
This prevents us from overwriting the previous calculation when setting extent.
Further, instead of setting and manipulating the selection, simply set up start and end VisiblePositions and
create a new directional selection so as to set the base and extent simultaneously.
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::setSelection):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/ChangeLog (147466 => 147467)
--- trunk/Source/WebKit/blackberry/ChangeLog 2013-04-02 18:16:36 UTC (rev 147466)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2013-04-02 18:17:10 UTC (rev 147467)
@@ -1,3 +1,21 @@
+2013-04-02 Nima Ghanavatian <[email protected]>
+
+ [BlackBerry] Create a selection from two points irregardless of the caret position.
+ https://bugs.webkit.org/show_bug.cgi?id=113795
+
+ Reviewed by Rob Buis.
+
+ Internally reviewed by Mike Fenton.
+
+ PR276577
+ If we are to set both the base and extent of a selection, we should maintain the base upon setting the extent.
+ This prevents us from overwriting the previous calculation when setting extent.
+ Further, instead of setting and manipulating the selection, simply set up start and end VisiblePositions and
+ create a new directional selection so as to set the base and extent simultaneously.
+
+ * WebKitSupport/SelectionHandler.cpp:
+ (BlackBerry::WebKit::SelectionHandler::setSelection):
+
2013-04-01 Konrad Piascik <[email protected]>
[BlackBerry] Move Path into it's own header
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (147466 => 147467)
--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp 2013-04-02 18:16:36 UTC (rev 147466)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp 2013-04-02 18:17:10 UTC (rev 147467)
@@ -507,44 +507,32 @@
WebCore::IntPoint relativeStart = start;
WebCore::IntPoint relativeEnd = end;
- VisibleSelection newSelection(controller->selection());
+ // Initialize the new start and end of our selection at the current positions.
+ VisiblePosition newStart = controller->selection().visibleStart();
+ VisiblePosition newEnd = controller->selection().visibleEnd();
- // We need the selection to be ordered base then extent.
- 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);
-
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 (base.isNotNull())
+ newStart = base;
}
if (m_lastUpdatedEndPointIsValid) {
relativeEnd = DOMSupport::convertPointToFrame(m_webPage->mainFrame(), focusedFrame, end);
-
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.
- }
+ if (extent.isNotNull())
+ newEnd = extent;
}
+ VisibleSelection newSelection(newStart, newEnd, true /* isDirectional */);
+
if (!controller->selection().isRange())
m_webPage->updateSelectionScrollView(newSelection.visibleEnd().deepEquivalent().anchorNode());
- newSelection.setIsDirectional(true);
-
if (m_webPage->m_inputHandler->isInputMode()) {
if (updateOrHandleInputSelection(newSelection, relativeStart, relativeEnd))
return;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes