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

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: Addressing feedback. 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 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 { 1237 {
1238 moveRangeSelection(baseInViewport, extentInViewport); 1238 moveRangeSelection(baseInViewport, extentInViewport);
1239 } 1239 }
1240 1240
1241 void WebLocalFrameImpl::selectRange(const WebRange& webRange) 1241 void WebLocalFrameImpl::selectRange(const WebRange& webRange)
1242 { 1242 {
1243 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange)) 1243 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange))
1244 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered); 1244 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered);
1245 } 1245 }
1246 1246
1247 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& pointInViewport , WebFrame::TextGranularity granularity) 1247 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point)
1248 { 1248 {
1249 blink::TextGranularity blinkGranularity = blink::CharacterGranularity; 1249 frame()->selection().moveRangeSelectionExtent(visiblePositionForViewportPoin t(point));
1250 if (granularity == WebFrame::WordGranularity)
1251 blinkGranularity = blink::WordGranularity;
1252 frame()->selection().moveRangeSelectionExtent(visiblePositionForViewportPoin t(pointInViewport), blinkGranularity);
1253 } 1250 }
1254 1251
1255 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity) 1252 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity)
1256 { 1253 {
1257 blink::TextGranularity blinkGranularity = blink::CharacterGranularity; 1254 blink::TextGranularity blinkGranularity = blink::CharacterGranularity;
1258 if (granularity == WebFrame::WordGranularity) 1255 if (granularity == WebFrame::WordGranularity)
1259 blinkGranularity = blink::WordGranularity; 1256 blinkGranularity = blink::WordGranularity;
1260 frame()->selection().moveRangeSelection( 1257 frame()->selection().moveRangeSelection(
1261 visiblePositionForViewportPoint(baseInViewport), 1258 visiblePositionForViewportPoint(baseInViewport),
1262 visiblePositionForViewportPoint(extentInViewport), 1259 visiblePositionForViewportPoint(extentInViewport),
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 { 2104 {
2108 m_frameWidget = frameWidget; 2105 m_frameWidget = frameWidget;
2109 } 2106 }
2110 2107
2111 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const 2108 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const
2112 { 2109 {
2113 return m_frameWidget; 2110 return m_frameWidget;
2114 } 2111 }
2115 2112
2116 } // namespace blink 2113 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698