Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(474)

Side by Side Diff: Source/web/WebLocalFrameImpl.cpp

Issue 675413003: WebLocalFrameImpl::selectWordAroundPosition should select a word before space. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1139 1139
1140 RefPtrWillBeRawPtr<Range> range = frame()->selection().toNormalizedRange(); 1140 RefPtrWillBeRawPtr<Range> range = frame()->selection().toNormalizedRange();
1141 if (!range) 1141 if (!range)
1142 return WebString(); 1142 return WebString();
1143 1143
1144 return createMarkup(range.get(), 0, AnnotateForInterchange, false, ResolveNo nLocalURLs); 1144 return createMarkup(range.get(), 0, AnnotateForInterchange, false, ResolveNo nLocalURLs);
1145 } 1145 }
1146 1146
1147 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosit ion position) 1147 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosit ion position)
1148 { 1148 {
1149 VisibleSelection selection(position); 1149 frame->selection().selectWordAroundPosition(position);
1150 selection.expandUsingGranularity(WordGranularity);
1151
1152 TextGranularity granularity = selection.isRange() ? WordGranularity : Charac terGranularity;
1153 frame->selection().setSelection(selection, granularity);
1154 } 1150 }
1155 1151
1156 bool WebLocalFrameImpl::selectWordAroundCaret() 1152 bool WebLocalFrameImpl::selectWordAroundCaret()
1157 { 1153 {
1158 FrameSelection& selection = frame()->selection(); 1154 FrameSelection& selection = frame()->selection();
1159 if (selection.isNone() || selection.isRange()) 1155 if (selection.isNone() || selection.isRange())
1160 return false; 1156 return false;
1161 selectWordAroundPosition(frame(), selection.selection().visibleStart()); 1157 selectWordAroundPosition(frame(), selection.selection().visibleStart());
1162 return true; 1158 return true;
1163 } 1159 }
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1961 1957
1962 void WebLocalFrameImpl::invalidateAll() const 1958 void WebLocalFrameImpl::invalidateAll() const
1963 { 1959 {
1964 ASSERT(frame() && frame()->view()); 1960 ASSERT(frame() && frame()->view());
1965 FrameView* view = frame()->view(); 1961 FrameView* view = frame()->view();
1966 view->invalidateRect(view->frameRect()); 1962 view->invalidateRect(view->frameRect());
1967 invalidateScrollbar(); 1963 invalidateScrollbar();
1968 } 1964 }
1969 1965
1970 } // namespace blink 1966 } // namespace blink
OLDNEW
« Source/core/editing/FrameSelectionTest.cpp ('K') | « Source/core/editing/FrameSelectionTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698