Changeset 183077 in webkit
- Timestamp:
- Apr 21, 2015, 3:01:52 PM (10 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r183074 r183077 1 2015-04-21 Brent Fulgham <bfulgham@apple.com> 2 3 Context menu doesn't account for selection semantics 4 https://bugs.webkit.org/show_bug.cgi?id=143958 5 <rdar://problem/19735706> 6 7 Reviewed by Tim Horton. 8 9 Before using the default word-only selection, check with the 10 lookup service to see if we can get a semantically appropriate 11 selection. 12 13 * page/EventHandler.cpp: 14 (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup): 15 (WebCore::EventHandler::selectClosestWordFromHitTestResult): 16 * page/EventHandler.h: 17 * page/mac/EventHandlerMac.mm: 18 (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup): 19 1 20 2015-04-21 Anders Carlsson <andersca@apple.com> 2 21 -
trunk/Source/WebCore/page/EventHandler.cpp
r182963 r183077 570 570 } 571 571 572 #if !PLATFORM(MAC) 573 VisibleSelection EventHandler::selectClosestWordFromHitTestResultBasedOnLookup(const HitTestResult&) 574 { 575 return VisibleSelection(); 576 } 577 #endif 578 572 579 void EventHandler::selectClosestWordFromHitTestResult(const HitTestResult& result, AppendTrailingWhitespace appendTrailingWhitespace) 573 580 { … … 576 583 577 584 if (targetNode && targetNode->renderer()) { 578 VisiblePosition pos(targetNode->renderer()->positionForPoint(result.localPoint(), nullptr)); 579 if (pos.isNotNull()) { 580 newSelection = VisibleSelection(pos); 581 newSelection.expandUsingGranularity(WordGranularity); 582 } 583 584 if (appendTrailingWhitespace == ShouldAppendTrailingWhitespace && newSelection.isRange()) 585 newSelection.appendTrailingWhitespace(); 585 newSelection = selectClosestWordFromHitTestResultBasedOnLookup(result); 586 if (newSelection.isNone()) { 587 VisiblePosition pos(targetNode->renderer()->positionForPoint(result.localPoint(), nullptr)); 588 if (pos.isNotNull()) { 589 newSelection = VisibleSelection(pos); 590 newSelection.expandUsingGranularity(WordGranularity); 591 } 592 593 if (appendTrailingWhitespace == ShouldAppendTrailingWhitespace && newSelection.isRange()) 594 newSelection.appendTrailingWhitespace(); 595 } 586 596 587 597 updateSelectionForMouseDownDispatchingSelectStart(targetNode, expandSelectionToRespectSelectOnMouseDown(*targetNode, newSelection), WordGranularity); -
trunk/Source/WebCore/page/EventHandler.h
r182963 r183077 326 326 bool updateSelectionForMouseDownDispatchingSelectStart(Node*, const VisibleSelection&, TextGranularity); 327 327 void selectClosestWordFromHitTestResult(const HitTestResult&, AppendTrailingWhitespace); 328 VisibleSelection selectClosestWordFromHitTestResultBasedOnLookup(const HitTestResult&); 328 329 void selectClosestWordFromMouseEvent(const MouseEventWithHitTestResults&); 329 330 void selectClosestWordOrLinkFromMouseEvent(const MouseEventWithHitTestResults&); -
trunk/Source/WebCore/page/mac/EventHandlerMac.mm
r182334 r183077 32 32 #include "ChromeClient.h" 33 33 #include "DataTransfer.h" 34 #include "DictionaryLookup.h" 34 35 #include "DragController.h" 35 36 #include "EventNames.h" … … 46 47 #include "Pasteboard.h" 47 48 #include "PlatformEventFactoryMac.h" 49 #include "Range.h" 48 50 #include "RenderLayer.h" 49 51 #include "RenderListBox.h" … … 1008 1010 } 1009 1011 1010 } 1012 VisibleSelection EventHandler::selectClosestWordFromHitTestResultBasedOnLookup(const HitTestResult& result) 1013 { 1014 NSDictionary *options = nil; 1015 if (RefPtr<Range> range = rangeForDictionaryLookupAtHitTestResult(result, &options)) 1016 return VisibleSelection(range.get()); 1017 1018 return VisibleSelection(); 1019 } 1020 1021 }
Note:
See TracChangeset
for help on using the changeset viewer.