Changeset 142011 in webkit
- Timestamp:
- Feb 6, 2013 11:07:27 AM (11 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r142008 r142011 1 2013-02-06 Chris Hopman <cjhopman@chromium.org> 2 3 [Chromium] WebWidget should expose a way to determine the start/end of the selection bounds 4 https://bugs.webkit.org/show_bug.cgi?id=108667 5 6 Reviewed by Darin Fisher. 7 8 WebWidget::selectionBounds() returns the anchor and focus of the 9 selection. This matches the arguments to WebFrame::selectRange(). 10 Add WebWidget::isSelectionAnchorFirst so that a caller can convert the 11 anchor/focus to start/end. 12 13 * public/WebWidget.h: 14 (WebWidget): 15 (WebKit::WebWidget::isSelectionAnchorFirst): 16 * src/WebViewImpl.cpp: 17 (WebKit::WebViewImpl::isSelectionAnchorFirst): 18 (WebKit): 19 * src/WebViewImpl.h: 20 * tests/WebViewTest.cpp: 21 1 22 2013-02-06 Alec Flett <alecflett@chromium.org> 2 23 -
trunk/Source/WebKit/chromium/public/WebWidget.h
r141428 r142011 199 199 virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const { return false; } 200 200 201 // Returns true if the selection range is nonempty and its anchor is first 202 // (i.e its anchor is its start). 203 virtual bool isSelectionAnchorFirst() const { return false; } 204 201 205 // Fetch the current selection range of this WebWidget. If there is no 202 206 // selection, it will output a 0-length range with the location at the -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r141657 r142011 2419 2419 } 2420 2420 2421 bool WebViewImpl::isSelectionAnchorFirst() const 2422 { 2423 const Frame* frame = focusedWebCoreFrame(); 2424 if (!frame) 2425 return false; 2426 FrameSelection* selection = frame->selection(); 2427 if (!selection) 2428 return false; 2429 return selection->selection().isBaseFirst(); 2430 } 2431 2421 2432 bool WebViewImpl::setEditableSelectionOffsets(int start, int end) 2422 2433 { -
trunk/Source/WebKit/chromium/src/WebViewImpl.h
r141483 r142011 173 173 virtual bool selectionBounds(WebRect& anchor, WebRect& focus) const; 174 174 virtual bool selectionTextDirection(WebTextDirection& start, WebTextDirection& end) const; 175 virtual bool isSelectionAnchorFirst() const; 175 176 virtual bool caretOrSelectionRange(size_t* location, size_t* length); 176 177 virtual void setTextDirection(WebTextDirection direction); -
trunk/Source/WebKit/chromium/tests/WebViewTest.cpp
r141540 r142011 457 457 } 458 458 459 TEST_F(WebViewTest, IsSelectionAnchorFirst) 460 { 461 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); 462 WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html"); 463 WebFrame* frame = webView->mainFrame(); 464 465 webView->setInitialFocus(false); 466 webView->setEditableSelectionOffsets(4, 10); 467 EXPECT_TRUE(webView->isSelectionAnchorFirst()); 468 WebRect anchor; 469 WebRect focus; 470 webView->selectionBounds(anchor, focus); 471 frame->selectRange(WebPoint(focus.x, focus.y), WebPoint(anchor.x, anchor.y)); 472 EXPECT_FALSE(webView->isSelectionAnchorFirst()); 473 webView->close(); 474 } 475 459 476 TEST_F(WebViewTest, ResetScrollAndScaleState) 460 477 {
Note: See TracChangeset
for help on using the changeset viewer.