Title: [148302] trunk/Source/WebKit/blackberry
- Revision
- 148302
- Author
- [email protected]
- Date
- 2013-04-12 13:44:38 -0700 (Fri, 12 Apr 2013)
Log Message
[BlackBerry] Enable selecting text in single line input field without selection point being actually on the targeted text vertically
https://bugs.webkit.org/show_bug.cgi?id=114515
Patch by Yongxin Dai <[email protected]> on 2013-04-12
Reviewed by Rob Buis.
PR #317924.
Internally reviewed by Mike Fenton.
It was still hard to select text in URL bar with an inverted selection handle.
We improve the issue by replacing the Y coordinate of selection point with Y
coordinate of start caret for single line input filed. Thus, the Y coordinate
is always valid regardless of the actual location of the selection handle.
* WebKitSupport/SelectionHandler.cpp:
(BlackBerry::WebKit::SelectionHandler::setSelection):
(BlackBerry::WebKit::SelectionHandler::startCaretViewportRect):
(WebKit):
(BlackBerry::WebKit::SelectionHandler::caretPositionChanged):
* WebKitSupport/SelectionHandler.h:
(SelectionHandler):
Modified Paths
Diff
Modified: trunk/Source/WebKit/blackberry/ChangeLog (148301 => 148302)
--- trunk/Source/WebKit/blackberry/ChangeLog 2013-04-12 20:28:55 UTC (rev 148301)
+++ trunk/Source/WebKit/blackberry/ChangeLog 2013-04-12 20:44:38 UTC (rev 148302)
@@ -1,3 +1,26 @@
+2013-04-12 Yongxin Dai <[email protected]>
+
+ [BlackBerry] Enable selecting text in single line input field without selection point being actually on the targeted text vertically
+ https://bugs.webkit.org/show_bug.cgi?id=114515
+
+ Reviewed by Rob Buis.
+
+ PR #317924.
+ Internally reviewed by Mike Fenton.
+
+ It was still hard to select text in URL bar with an inverted selection handle.
+ We improve the issue by replacing the Y coordinate of selection point with Y
+ coordinate of start caret for single line input filed. Thus, the Y coordinate
+ is always valid regardless of the actual location of the selection handle.
+
+ * WebKitSupport/SelectionHandler.cpp:
+ (BlackBerry::WebKit::SelectionHandler::setSelection):
+ (BlackBerry::WebKit::SelectionHandler::startCaretViewportRect):
+ (WebKit):
+ (BlackBerry::WebKit::SelectionHandler::caretPositionChanged):
+ * WebKitSupport/SelectionHandler.h:
+ (SelectionHandler):
+
2013-04-12 Carlos Garcia Campos <[email protected]>
[BlackBerry] Crash running layout tests
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp (148301 => 148302)
--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp 2013-04-12 20:28:55 UTC (rev 148301)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp 2013-04-12 20:44:38 UTC (rev 148302)
@@ -476,7 +476,7 @@
return true;
}
-void SelectionHandler::setSelection(const WebCore::IntPoint& start, const WebCore::IntPoint& end)
+void SelectionHandler::setSelection(WebCore::IntPoint start, WebCore::IntPoint end)
{
m_selectionActive = true;
@@ -504,6 +504,17 @@
// At least one of the locations must be valid.
ASSERT(startIsValid || m_lastUpdatedEndPointIsValid);
+ if (m_webPage->m_inputHandler->isInputMode() && !m_webPage->m_inputHandler->isMultilineInputMode()) {
+ WebCore::IntRect caret(startCaretViewportRect(m_webPage->frameOffset(focusedFrame)));
+ if (!caret.isEmpty()) {
+ int centerOfCaretY = caret.center().y();
+ if (startIsValid)
+ start.setY(centerOfCaretY);
+ if (m_lastUpdatedEndPointIsValid)
+ end.setY(centerOfCaretY);
+ }
+ }
+
WebCore::IntPoint relativeStart = start;
WebCore::IntPoint relativeEnd = end;
@@ -623,6 +634,21 @@
return false;
}
+WebCore::IntRect SelectionHandler::startCaretViewportRect(const WebCore::IntPoint& frameOffset) const
+{
+ WebCore::IntRect caretRect;
+ Frame* frame = m_webPage->focusedOrMainFrame();
+ if (!frame)
+ return caretRect;
+
+ if (frame->selection()->selectionType() != VisibleSelection::NoSelection) {
+ caretRect = frame->selection()->selection().visibleStart().absoluteCaretBounds();
+ caretRect.moveBy(frameOffset);
+ }
+
+ return caretRect;
+}
+
void SelectionHandler::selectAtPoint(const WebCore::IntPoint& location, SelectionExpansionType selectionExpansionType)
{
if (selectionExpansionType == Word) {
@@ -1274,14 +1300,12 @@
// This function should only reach this point if input mode is active.
ASSERT(m_webPage->m_inputHandler->isInputMode());
+ WebCore::IntRect clippingRectForContent(clippingRectForVisibleContent());
WebCore::IntPoint frameOffset(m_webPage->frameOffset(m_webPage->focusedOrMainFrame()));
- WebCore::IntRect clippingRectForContent(clippingRectForVisibleContent());
if (m_webPage->focusedOrMainFrame()->selection()->selectionType() == VisibleSelection::CaretSelection) {
- caretLocation = m_webPage->focusedOrMainFrame()->selection()->selection().visibleStart().absoluteCaretBounds();
- caretLocation.move(frameOffset.x(), frameOffset.y());
-
- // Clip against the containing frame and node boundaries.
- caretLocation.intersect(clippingRectForContent);
+ caretLocation = startCaretViewportRect(frameOffset);
+ if (!caretLocation.isEmpty())
+ caretLocation.intersect(clippingRectForContent); // Clip against the containing frame and node boundaries.
}
m_caretActive = !caretLocation.isEmpty();
@@ -1294,7 +1318,7 @@
WebCore::IntRect nodeBoundingBox = isSingleLineInput ? m_webPage->m_inputHandler->boundingBoxForInputField() : WebCore::IntRect();
if (!nodeBoundingBox.isEmpty()) {
- nodeBoundingBox.move(frameOffset.x(), frameOffset.y());
+ nodeBoundingBox.moveBy(frameOffset);
// Clip against the containing frame and node boundaries.
nodeBoundingBox.intersect(clippingRectForContent);
Modified: trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h (148301 => 148302)
--- trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h 2013-04-12 20:28:55 UTC (rev 148301)
+++ trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h 2013-04-12 20:44:38 UTC (rev 148302)
@@ -63,7 +63,7 @@
bool selectionContains(const WebCore::IntPoint&);
- void setSelection(const WebCore::IntPoint& start, const WebCore::IntPoint& end);
+ void setSelection(WebCore::IntPoint start, WebCore::IntPoint end);
void selectAtPoint(const WebCore::IntPoint&, SelectionExpansionType);
void selectObject(const WebCore::IntPoint&, WebCore::TextGranularity);
void selectObject(WebCore::TextGranularity);
@@ -107,6 +107,8 @@
bool selectNodeIfFatFingersResultIsLink(FatFingersResult);
+ WebCore::IntRect startCaretViewportRect(const WebCore::IntPoint& frameOffset) const;
+
WebPagePrivate* m_webPage;
bool m_selectionActive;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes