+2012-03-27 Sean Wang <Xuewen.Wang@torchmobile.com.cn>
+
+ [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 <anlo@rim.com>
[BlackBerry] Switch WebPageCompositor to use AnimationFrameRateController instead of timer
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();
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);