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

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: nit picks 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 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after
1153 1153
1154 return createMarkup(range.get(), 0, AnnotateForInterchange, false, ResolveNo nLocalURLs); 1154 return createMarkup(range.get(), 0, AnnotateForInterchange, false, ResolveNo nLocalURLs);
1155 } 1155 }
1156 1156
1157 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosit ion position) 1157 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosit ion position)
1158 { 1158 {
1159 VisibleSelection selection(position); 1159 VisibleSelection selection(position);
1160 selection.expandUsingGranularity(WordGranularity); 1160 selection.expandUsingGranularity(WordGranularity);
1161 1161
1162 TextGranularity granularity = selection.isRange() ? WordGranularity : Charac terGranularity; 1162 TextGranularity granularity = selection.isRange() ? WordGranularity : Charac terGranularity;
1163 frame->selection().setSelection(selection, granularity); 1163 frame->selection().setSelection(selection, granularity);
Yuta Kitamura 2014/11/14 05:14:57 Why don't you update this function as well?
yoichio 2014/11/14 06:19:59 I was not sure but confirmed that selectWordAround
1164 } 1164 }
1165 1165
1166 bool WebLocalFrameImpl::selectWordAroundCaret() 1166 bool WebLocalFrameImpl::selectWordAroundCaret()
1167 { 1167 {
1168 FrameSelection& selection = frame()->selection(); 1168 FrameSelection& selection = frame()->selection();
1169 if (selection.isNone() || selection.isRange()) 1169 if (selection.isNone() || selection.isRange())
1170 return false; 1170 return false;
1171 selectWordAroundPosition(frame(), selection.selection().visibleStart()); 1171 return frame()->selection().selectWordAroundPosition(selection.selection().v isibleStart());
1172 return true;
1173 } 1172 }
1174 1173
1175 void WebLocalFrameImpl::selectRange(const WebPoint& base, const WebPoint& extent ) 1174 void WebLocalFrameImpl::selectRange(const WebPoint& base, const WebPoint& extent )
1176 { 1175 {
1177 moveRangeSelection(base, extent); 1176 moveRangeSelection(base, extent);
1178 } 1177 }
1179 1178
1180 void WebLocalFrameImpl::selectRange(const WebRange& webRange) 1179 void WebLocalFrameImpl::selectRange(const WebRange& webRange)
1181 { 1180 {
1182 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge> >(webRange)) 1181 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge> >(webRange))
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1973 1972
1974 void WebLocalFrameImpl::invalidateAll() const 1973 void WebLocalFrameImpl::invalidateAll() const
1975 { 1974 {
1976 ASSERT(frame() && frame()->view()); 1975 ASSERT(frame() && frame()->view());
1977 FrameView* view = frame()->view(); 1976 FrameView* view = frame()->view();
1978 view->invalidateRect(view->frameRect()); 1977 view->invalidateRect(view->frameRect());
1979 invalidateScrollbar(); 1978 invalidateScrollbar();
1980 } 1979 }
1981 1980
1982 } // namespace blink 1981 } // 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