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

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

Issue 1123563003: Improving direction-based selection strategy. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressing rotated text + comment cleanup Created 5 years, 7 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 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 } 1254 }
1255 1255
1256 void WebLocalFrameImpl::selectRange(const WebRange& webRange) 1256 void WebLocalFrameImpl::selectRange(const WebRange& webRange)
1257 { 1257 {
1258 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange)) 1258 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange))
1259 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered); 1259 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered);
1260 } 1260 }
1261 1261
1262 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point) 1262 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point)
1263 { 1263 {
1264 frame()->selection().moveRangeSelectionExtent(visiblePositionForViewportPoin t(point)); 1264 frame()->selection().moveRangeSelectionExtent(frame()->view()->viewportToCon tents(point));
1265 } 1265 }
1266 1266
1267 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity) 1267 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity)
1268 { 1268 {
1269 blink::TextGranularity blinkGranularity = blink::CharacterGranularity; 1269 blink::TextGranularity blinkGranularity = blink::CharacterGranularity;
1270 if (granularity == WebFrame::WordGranularity) 1270 if (granularity == WebFrame::WordGranularity)
1271 blinkGranularity = blink::WordGranularity; 1271 blinkGranularity = blink::WordGranularity;
1272 frame()->selection().moveRangeSelection( 1272 frame()->selection().moveRangeSelection(
1273 visiblePositionForViewportPoint(baseInViewport), 1273 visiblePositionForViewportPoint(baseInViewport),
1274 visiblePositionForViewportPoint(extentInViewport), 1274 visiblePositionForViewportPoint(extentInViewport),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1315 frame()->inputMethodController().extendSelectionAndDelete(before, after); 1315 frame()->inputMethodController().extendSelectionAndDelete(before, after);
1316 } 1316 }
1317 1317
1318 void WebLocalFrameImpl::setCaretVisible(bool visible) 1318 void WebLocalFrameImpl::setCaretVisible(bool visible)
1319 { 1319 {
1320 frame()->selection().setCaretVisible(visible); 1320 frame()->selection().setCaretVisible(visible);
1321 } 1321 }
1322 1322
1323 VisiblePosition WebLocalFrameImpl::visiblePositionForViewportPoint(const WebPoin t& pointInViewport) 1323 VisiblePosition WebLocalFrameImpl::visiblePositionForViewportPoint(const WebPoin t& pointInViewport)
1324 { 1324 {
1325 HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | H itTestRequest::Active | HitTestRequest::IgnoreClipping; 1325 return visiblePositionForContentsPoint(frame()->view()->viewportToContents(p ointInViewport), frame());
1326 HitTestResult result(request, frame()->view()->viewportToContents(pointInVie wport));
1327 frame()->document()->layoutView()->hitTest(result);
1328
1329 if (Node* node = result.innerNode())
1330 return frame()->selection().selection().visiblePositionRespectingEditing Boundary(result.localPoint(), node);
1331 return VisiblePosition();
1332 } 1326 }
1333 1327
1334 WebPlugin* WebLocalFrameImpl::focusedPluginIfInputMethodSupported() 1328 WebPlugin* WebLocalFrameImpl::focusedPluginIfInputMethodSupported()
1335 { 1329 {
1336 WebPluginContainerImpl* container = WebLocalFrameImpl::pluginContainerFromNo de(frame(), WebNode(frame()->document()->focusedElement())); 1330 WebPluginContainerImpl* container = WebLocalFrameImpl::pluginContainerFromNo de(frame(), WebNode(frame()->document()->focusedElement()));
1337 if (container && container->supportsInputMethod()) 1331 if (container && container->supportsInputMethod())
1338 return container->plugin(); 1332 return container->plugin();
1339 return 0; 1333 return 0;
1340 } 1334 }
1341 1335
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after
2113 { 2107 {
2114 m_frameWidget = frameWidget; 2108 m_frameWidget = frameWidget;
2115 } 2109 }
2116 2110
2117 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const 2111 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const
2118 { 2112 {
2119 return m_frameWidget; 2113 return m_frameWidget;
2120 } 2114 }
2121 2115
2122 } // namespace blink 2116 } // namespace blink
OLDNEW
« Source/core/editing/GranularityStrategy.h ('K') | « Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698