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

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: Removing anonymous namespace and marking functions static instead. Created 5 years, 6 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
« no previous file with comments | « Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1268 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 } 1279 }
1280 1280
1281 void WebLocalFrameImpl::selectRange(const WebRange& webRange) 1281 void WebLocalFrameImpl::selectRange(const WebRange& webRange)
1282 { 1282 {
1283 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange)) 1283 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange))
1284 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered); 1284 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered);
1285 } 1285 }
1286 1286
1287 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point) 1287 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point)
1288 { 1288 {
1289 frame()->selection().moveRangeSelectionExtent(visiblePositionForViewportPoin t(point)); 1289 frame()->selection().moveRangeSelectionExtent(frame()->view()->viewportToCon tents(point));
1290 } 1290 }
1291 1291
1292 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity) 1292 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity)
1293 { 1293 {
1294 blink::TextGranularity blinkGranularity = blink::CharacterGranularity; 1294 blink::TextGranularity blinkGranularity = blink::CharacterGranularity;
1295 if (granularity == WebFrame::WordGranularity) 1295 if (granularity == WebFrame::WordGranularity)
1296 blinkGranularity = blink::WordGranularity; 1296 blinkGranularity = blink::WordGranularity;
1297 frame()->selection().moveRangeSelection( 1297 frame()->selection().moveRangeSelection(
1298 visiblePositionForViewportPoint(baseInViewport), 1298 visiblePositionForViewportPoint(baseInViewport),
1299 visiblePositionForViewportPoint(extentInViewport), 1299 visiblePositionForViewportPoint(extentInViewport),
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 frame()->inputMethodController().extendSelectionAndDelete(before, after); 1340 frame()->inputMethodController().extendSelectionAndDelete(before, after);
1341 } 1341 }
1342 1342
1343 void WebLocalFrameImpl::setCaretVisible(bool visible) 1343 void WebLocalFrameImpl::setCaretVisible(bool visible)
1344 { 1344 {
1345 frame()->selection().setCaretVisible(visible); 1345 frame()->selection().setCaretVisible(visible);
1346 } 1346 }
1347 1347
1348 VisiblePosition WebLocalFrameImpl::visiblePositionForViewportPoint(const WebPoin t& pointInViewport) 1348 VisiblePosition WebLocalFrameImpl::visiblePositionForViewportPoint(const WebPoin t& pointInViewport)
1349 { 1349 {
1350 HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | H itTestRequest::Active | HitTestRequest::IgnoreClipping; 1350 return visiblePositionForContentsPoint(frame()->view()->viewportToContents(p ointInViewport), frame());
1351 HitTestResult result(request, frame()->view()->viewportToContents(pointInVie wport));
1352 frame()->document()->layoutView()->hitTest(result);
1353
1354 if (Node* node = result.innerNode())
1355 return frame()->selection().selection().visiblePositionRespectingEditing Boundary(result.localPoint(), node);
1356 return VisiblePosition();
1357 } 1351 }
1358 1352
1359 WebPlugin* WebLocalFrameImpl::focusedPluginIfInputMethodSupported() 1353 WebPlugin* WebLocalFrameImpl::focusedPluginIfInputMethodSupported()
1360 { 1354 {
1361 WebPluginContainerImpl* container = WebLocalFrameImpl::pluginContainerFromNo de(frame(), WebNode(frame()->document()->focusedElement())); 1355 WebPluginContainerImpl* container = WebLocalFrameImpl::pluginContainerFromNo de(frame(), WebNode(frame()->document()->focusedElement()));
1362 if (container && container->supportsInputMethod()) 1356 if (container && container->supportsInputMethod())
1363 return container->plugin(); 1357 return container->plugin();
1364 return 0; 1358 return 0;
1365 } 1359 }
1366 1360
(...skipping 741 matching lines...) Expand 10 before | Expand all | Expand 10 after
2108 { 2102 {
2109 m_frameWidget = frameWidget; 2103 m_frameWidget = frameWidget;
2110 } 2104 }
2111 2105
2112 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const 2106 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const
2113 { 2107 {
2114 return m_frameWidget; 2108 return m_frameWidget;
2115 } 2109 }
2116 2110
2117 } // namespace blink 2111 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/VisibleUnits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698