Changeset 148302 in webkit
- Timestamp:
- Apr 12, 2013 1:44:38 PM (11 years ago)
- Location:
- trunk/Source/WebKit/blackberry
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/blackberry/ChangeLog
r148277 r148302 1 2013-04-12 Yongxin Dai <yodai@rim.com> 2 3 [BlackBerry] Enable selecting text in single line input field without selection point being actually on the targeted text vertically 4 https://bugs.webkit.org/show_bug.cgi?id=114515 5 6 Reviewed by Rob Buis. 7 8 PR #317924. 9 Internally reviewed by Mike Fenton. 10 11 It was still hard to select text in URL bar with an inverted selection handle. 12 We improve the issue by replacing the Y coordinate of selection point with Y 13 coordinate of start caret for single line input filed. Thus, the Y coordinate 14 is always valid regardless of the actual location of the selection handle. 15 16 * WebKitSupport/SelectionHandler.cpp: 17 (BlackBerry::WebKit::SelectionHandler::setSelection): 18 (BlackBerry::WebKit::SelectionHandler::startCaretViewportRect): 19 (WebKit): 20 (BlackBerry::WebKit::SelectionHandler::caretPositionChanged): 21 * WebKitSupport/SelectionHandler.h: 22 (SelectionHandler): 23 1 24 2013-04-12 Carlos Garcia Campos <cgarcia@igalia.com> 2 25 -
trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.cpp
r147497 r148302 477 477 } 478 478 479 void SelectionHandler::setSelection( const WebCore::IntPoint& start, const WebCore::IntPoint&end)479 void SelectionHandler::setSelection(WebCore::IntPoint start, WebCore::IntPoint end) 480 480 { 481 481 m_selectionActive = true; … … 504 504 // At least one of the locations must be valid. 505 505 ASSERT(startIsValid || m_lastUpdatedEndPointIsValid); 506 507 if (m_webPage->m_inputHandler->isInputMode() && !m_webPage->m_inputHandler->isMultilineInputMode()) { 508 WebCore::IntRect caret(startCaretViewportRect(m_webPage->frameOffset(focusedFrame))); 509 if (!caret.isEmpty()) { 510 int centerOfCaretY = caret.center().y(); 511 if (startIsValid) 512 start.setY(centerOfCaretY); 513 if (m_lastUpdatedEndPointIsValid) 514 end.setY(centerOfCaretY); 515 } 516 } 506 517 507 518 WebCore::IntPoint relativeStart = start; … … 622 633 } 623 634 return false; 635 } 636 637 WebCore::IntRect SelectionHandler::startCaretViewportRect(const WebCore::IntPoint& frameOffset) const 638 { 639 WebCore::IntRect caretRect; 640 Frame* frame = m_webPage->focusedOrMainFrame(); 641 if (!frame) 642 return caretRect; 643 644 if (frame->selection()->selectionType() != VisibleSelection::NoSelection) { 645 caretRect = frame->selection()->selection().visibleStart().absoluteCaretBounds(); 646 caretRect.moveBy(frameOffset); 647 } 648 649 return caretRect; 624 650 } 625 651 … … 1275 1301 ASSERT(m_webPage->m_inputHandler->isInputMode()); 1276 1302 1303 WebCore::IntRect clippingRectForContent(clippingRectForVisibleContent()); 1277 1304 WebCore::IntPoint frameOffset(m_webPage->frameOffset(m_webPage->focusedOrMainFrame())); 1278 WebCore::IntRect clippingRectForContent(clippingRectForVisibleContent());1279 1305 if (m_webPage->focusedOrMainFrame()->selection()->selectionType() == VisibleSelection::CaretSelection) { 1280 caretLocation = m_webPage->focusedOrMainFrame()->selection()->selection().visibleStart().absoluteCaretBounds(); 1281 caretLocation.move(frameOffset.x(), frameOffset.y()); 1282 1283 // Clip against the containing frame and node boundaries. 1284 caretLocation.intersect(clippingRectForContent); 1306 caretLocation = startCaretViewportRect(frameOffset); 1307 if (!caretLocation.isEmpty()) 1308 caretLocation.intersect(clippingRectForContent); // Clip against the containing frame and node boundaries. 1285 1309 } 1286 1310 … … 1295 1319 1296 1320 if (!nodeBoundingBox.isEmpty()) { 1297 nodeBoundingBox.move (frameOffset.x(), frameOffset.y());1321 nodeBoundingBox.moveBy(frameOffset); 1298 1322 1299 1323 // Clip against the containing frame and node boundaries. -
trunk/Source/WebKit/blackberry/WebKitSupport/SelectionHandler.h
r145720 r148302 64 64 bool selectionContains(const WebCore::IntPoint&); 65 65 66 void setSelection( const WebCore::IntPoint& start, const WebCore::IntPoint&end);66 void setSelection(WebCore::IntPoint start, WebCore::IntPoint end); 67 67 void selectAtPoint(const WebCore::IntPoint&, SelectionExpansionType); 68 68 void selectObject(const WebCore::IntPoint&, WebCore::TextGranularity); … … 108 108 bool selectNodeIfFatFingersResultIsLink(FatFingersResult); 109 109 110 WebCore::IntRect startCaretViewportRect(const WebCore::IntPoint& frameOffset) const; 111 110 112 WebPagePrivate* m_webPage; 111 113
Note: See TracChangeset
for help on using the changeset viewer.