Changeset 85001 in webkit
- Timestamp:
- Apr 26, 2011 7:00:25 PM (13 years ago)
- Location:
- trunk/Source/WebKit/chromium
- Files:
-
- 2 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/chromium/ChangeLog
r84991 r85001 1 2011-04-26 Dirk Pranke <dpranke@chromium.org> 2 3 Unreviewed, rolling out r84982. 4 http://trac.webkit.org/changeset/84982 5 https://bugs.webkit.org/show_bug.cgi?id=59558 6 7 re-land r84951 8 9 * WebKit.gyp: 10 * public/WebFrame.h: 11 * public/WebWidget.h: 12 * public/mac/WebSubstringUtil.h: Added. 13 * src/WebFrameImpl.cpp: 14 (WebKit::WebFrameImpl::firstRectForCharacterRange): 15 (WebKit::WebFrameImpl::characterIndexForPoint): 16 * src/WebFrameImpl.h: 17 * src/WebPopupMenuImpl.cpp: 18 (WebKit::WebPopupMenuImpl::compositionRange): 19 (WebKit::WebPopupMenuImpl::caretOrSelectionRange): 20 * src/WebPopupMenuImpl.h: 21 * src/WebViewImpl.cpp: 22 (WebKit::WebViewImpl::compositionRange): 23 (WebKit::WebViewImpl::caretOrSelectionRange): 24 * src/WebViewImpl.h: 25 * src/mac/WebSubstringUtil.mm: Added. 26 (WebKit::WebSubstringUtil::attributedSubstringInRange): 27 1 28 2011-04-26 Sam Weinig <sam@webkit.org> 2 29 -
trunk/Source/WebKit/chromium/WebKit.gyp
r84982 r85001 97 97 'public/mac/WebSandboxSupport.h', 98 98 'public/mac/WebScreenInfoFactory.h', 99 'public/mac/WebSubstringUtil.h', 99 100 'public/mac/WebThemeEngine.h', 100 101 'public/WebAccessibilityCache.h', … … 385 386 'src/mac/WebInputEventFactory.mm', 386 387 'src/mac/WebScreenInfoFactory.mm', 388 'src/mac/WebSubstringUtil.mm', 387 389 'src/LocalFileSystemChromium.cpp', 388 390 'src/LocalizedStrings.cpp', -
trunk/Source/WebKit/chromium/public/WebFrame.h
r84982 r85001 397 397 virtual WebRange markedRange() const = 0; 398 398 399 // Returns the frame rectangle in window coordinate space of the given text 400 // range. 399 401 virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const = 0; 402 403 // Returns the index of a character in the Frame's text stream at the given 404 // point. The point is in the window coordinate space. Will return 405 // WTF::notFound if the point is invalid. 406 virtual size_t characterIndexForPoint(const WebPoint&) const = 0; 400 407 401 408 // Supports commands like Undo, Redo, Cut, Copy, Paste, SelectAll, -
trunk/Source/WebKit/chromium/public/WebWidget.h
r84982 r85001 41 41 42 42 class WebInputEvent; 43 class WebRange; 43 44 class WebString; 44 45 struct WebPoint; … … 121 122 virtual bool confirmComposition(const WebString& text) = 0; 122 123 124 // Fetches the character range of the current composition, also called the 125 // "marked range." Returns true and fills the out-paramters on success; 126 // returns false on failure. 127 virtual bool compositionRange(size_t* location, size_t* length) = 0; 128 123 129 // Returns the current text input type of this WebWidget. 124 130 virtual WebTextInputType textInputType() = 0; … … 131 137 // bottom of the selected line. 132 138 virtual bool selectionRange(WebPoint& start, WebPoint& end) const = 0; 139 140 // Fetch the current selection range of this WebWidget. If there is no 141 // selection, it will output a 0-length range with the location at the 142 // caret. Returns true and fills the out-paramters on success; returns false 143 // on failure. 144 virtual bool caretOrSelectionRange(size_t* location, size_t* length) = 0; 133 145 134 146 // Changes the text direction of the selected input node. -
trunk/Source/WebKit/chromium/src/WebFrameImpl.cpp
r84982 r85001 86 86 #include "Editor.h" 87 87 #include "EventHandler.h" 88 #include "FocusController.h" 88 89 #include "FormState.h" 89 90 #include "FrameLoadRequest.h" … … 91 92 #include "FrameTree.h" 92 93 #include "FrameView.h" 93 #include "HitTestResult.h"94 94 #include "HTMLCollection.h" 95 95 #include "HTMLFormElement.h" … … 100 100 #include "HTMLNames.h" 101 101 #include "HistoryItem.h" 102 #include "HitTestResult.h" 102 103 #include "InspectorController.h" 103 104 #include "Page.h" … … 1164 1165 return false; 1165 1166 IntRect intRect = frame()->editor()->firstRectForRange(range.get()); 1166 rect = WebRect(intRect.x(), intRect.y(), intRect.width(), intRect.height()); 1167 rect = WebRect(intRect); 1168 // When inside an text control, don't adjust the range. 1169 if (!selectionRoot) 1170 rect = frame()->view()->contentsToWindow(rect); 1167 1171 1168 1172 return true; 1173 } 1174 1175 size_t WebFrameImpl::characterIndexForPoint(const WebPoint& webPoint) const 1176 { 1177 if (!frame()) 1178 return notFound; 1179 1180 IntPoint point = frame()->view()->windowToContents(webPoint); 1181 HitTestResult result = frame()->eventHandler()->hitTestResultAtPoint(point, false); 1182 RefPtr<Range> range = frame()->rangeForPoint(result.point()); 1183 if (!range.get()) 1184 return notFound; 1185 1186 size_t location, length; 1187 TextIterator::locationAndLengthFromRange(range.get(), location, length); 1188 return location; 1169 1189 } 1170 1190 -
trunk/Source/WebKit/chromium/src/WebFrameImpl.h
r84982 r85001 153 153 virtual WebRange markedRange() const; 154 154 virtual bool firstRectForCharacterRange(unsigned location, unsigned length, WebRect&) const; 155 virtual size_t characterIndexForPoint(const WebPoint&) const; 155 156 virtual bool executeCommand(const WebString&); 156 157 virtual bool executeCommand(const WebString&, const WebString& value); -
trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp
r84982 r85001 44 44 #include "WebInputEvent.h" 45 45 #include "WebInputEventConversion.h" 46 #include "WebRange.h" 46 47 #include "WebRect.h" 47 48 #include "WebWidgetClient.h" … … 253 254 } 254 255 256 bool WebPopupMenuImpl::compositionRange(size_t* location, size_t* length) 257 { 258 *location = 0; 259 *length = 0; 260 return false; 261 } 262 255 263 WebTextInputType WebPopupMenuImpl::textInputType() 256 264 { … … 261 269 { 262 270 return WebRect(); 271 } 272 273 bool WebPopupMenuImpl::caretOrSelectionRange(size_t* location, size_t* length) 274 { 275 *location = 0; 276 *length = 0; 277 return false; 263 278 } 264 279 -
trunk/Source/WebKit/chromium/src/WebPopupMenuImpl.h
r84982 r85001 52 52 class WebMouseEvent; 53 53 class WebMouseWheelEvent; 54 class WebRange; 54 55 struct WebRect; 55 56 … … 77 78 virtual bool confirmComposition(); 78 79 virtual bool confirmComposition(const WebString& text); 80 virtual bool compositionRange(size_t* location, size_t* length); 79 81 virtual WebTextInputType textInputType(); 80 82 virtual WebRect caretOrSelectionBounds(); 81 83 virtual bool selectionRange(WebPoint& start, WebPoint& end) const { return false; } 84 virtual bool caretOrSelectionRange(size_t* location, size_t* length); 82 85 virtual void setTextDirection(WebTextDirection direction); 83 86 virtual bool isAcceleratedCompositingActive() const { return false; } -
trunk/Source/WebKit/chromium/src/WebViewImpl.cpp
r84982 r85001 92 92 #include "Settings.h" 93 93 #include "SpeechInputClientImpl.h" 94 #include "TextIterator.h" 94 95 #include "Timer.h" 95 96 #include "TraceEvent.h" … … 116 117 #include "WebPoint.h" 117 118 #include "WebPopupMenuImpl.h" 119 #include "WebRange.h" 118 120 #include "WebRect.h" 119 121 #include "WebRuntimeFeatures.h" … … 1395 1397 } 1396 1398 1399 bool WebViewImpl::compositionRange(size_t* location, size_t* length) 1400 { 1401 Frame* focused = focusedWebCoreFrame(); 1402 if (!focused || !m_imeAcceptEvents) 1403 return false; 1404 Editor* editor = focused->editor(); 1405 if (!editor || !editor->hasComposition()) 1406 return false; 1407 1408 RefPtr<Range> range = editor->compositionRange(); 1409 if (!range.get()) 1410 return false; 1411 1412 if (TextIterator::locationAndLengthFromRange(range.get(), *location, *length)) 1413 return true; 1414 return false; 1415 } 1416 1397 1417 WebTextInputType WebViewImpl::textInputType() 1398 1418 { … … 1484 1504 end = frame->view()->contentsToWindow(end); 1485 1505 return true; 1506 } 1507 1508 bool WebViewImpl::caretOrSelectionRange(size_t* location, size_t* length) 1509 { 1510 const Frame* focused = focusedWebCoreFrame(); 1511 if (!focused) 1512 return false; 1513 1514 SelectionController* controller = focused->selection(); 1515 if (!controller) 1516 return false; 1517 1518 RefPtr<Range> range = controller->selection().firstRange(); 1519 if (!range.get()) 1520 return false; 1521 1522 if (TextIterator::locationAndLengthFromRange(range.get(), *location, *length)) 1523 return true; 1524 return false; 1486 1525 } 1487 1526 -
trunk/Source/WebKit/chromium/src/WebViewImpl.h
r84982 r85001 108 108 virtual bool confirmComposition(); 109 109 virtual bool confirmComposition(const WebString& text); 110 virtual bool compositionRange(size_t* location, size_t* length); 110 111 virtual WebTextInputType textInputType(); 111 112 virtual WebRect caretOrSelectionBounds(); 112 113 virtual bool selectionRange(WebPoint& start, WebPoint& end) const; 114 virtual bool caretOrSelectionRange(size_t* location, size_t* length); 113 115 virtual void setTextDirection(WebTextDirection direction); 114 116 virtual bool isAcceleratedCompositingActive() const;
Note: See TracChangeset
for help on using the changeset viewer.