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

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

Issue 988023005: Implementing directional selection strategy in Blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Putting GranularityStrategy into separate files. Created 5 years, 8 months 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 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 { 1241 {
1242 moveRangeSelection(baseInViewport, extentInViewport); 1242 moveRangeSelection(baseInViewport, extentInViewport);
1243 } 1243 }
1244 1244
1245 void WebLocalFrameImpl::selectRange(const WebRange& webRange) 1245 void WebLocalFrameImpl::selectRange(const WebRange& webRange)
1246 { 1246 {
1247 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange)) 1247 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange))
1248 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered); 1248 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered);
1249 } 1249 }
1250 1250
1251 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& pointInViewport , WebFrame::TextGranularity granularity) 1251 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point)
1252 { 1252 {
1253 blink::TextGranularity blinkGranularity = blink::CharacterGranularity; 1253 frame()->selection().moveRangeSelectionExtent(visiblePositionForViewportPoin t(point));
1254 if (granularity == WebFrame::WordGranularity)
1255 blinkGranularity = blink::WordGranularity;
1256 frame()->selection().moveRangeSelectionExtent(visiblePositionForViewportPoin t(pointInViewport), blinkGranularity);
1257 } 1254 }
1258 1255
1259 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity) 1256 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity)
1260 { 1257 {
1261 blink::TextGranularity blinkGranularity = blink::CharacterGranularity; 1258 blink::TextGranularity blinkGranularity = blink::CharacterGranularity;
1262 if (granularity == WebFrame::WordGranularity) 1259 if (granularity == WebFrame::WordGranularity)
1263 blinkGranularity = blink::WordGranularity; 1260 blinkGranularity = blink::WordGranularity;
1264 frame()->selection().moveRangeSelection( 1261 frame()->selection().moveRangeSelection(
1265 visiblePositionForViewportPoint(baseInViewport), 1262 visiblePositionForViewportPoint(baseInViewport),
1266 visiblePositionForViewportPoint(extentInViewport), 1263 visiblePositionForViewportPoint(extentInViewport),
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
2111 { 2108 {
2112 m_frameWidget = frameWidget; 2109 m_frameWidget = frameWidget;
2113 } 2110 }
2114 2111
2115 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const 2112 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const
2116 { 2113 {
2117 return m_frameWidget; 2114 return m_frameWidget;
2118 } 2115 }
2119 2116
2120 } // namespace blink 2117 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698