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

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

Issue 2431153002: Introduce FrameSelection::moveCaretSelection() as replacement of moveTo() (Closed)
Patch Set: 2016-10-19T14:44:09 Created 4 years, 2 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 | « third_party/WebKit/Source/core/editing/FrameSelectionTest.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 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after
1255 visiblePositionForViewportPoint(baseInViewport), 1255 visiblePositionForViewportPoint(baseInViewport),
1256 visiblePositionForViewportPoint(extentInViewport), blinkGranularity); 1256 visiblePositionForViewportPoint(extentInViewport), blinkGranularity);
1257 } 1257 }
1258 1258
1259 void WebLocalFrameImpl::moveCaretSelection(const WebPoint& pointInViewport) { 1259 void WebLocalFrameImpl::moveCaretSelection(const WebPoint& pointInViewport) {
1260 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveCaretSelection"); 1260 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveCaretSelection");
1261 1261
1262 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets 1262 // TODO(editing-dev): The use of updateStyleAndLayoutIgnorePendingStylesheets
1263 // needs to be audited. see http://crbug.com/590369 for more details. 1263 // needs to be audited. see http://crbug.com/590369 for more details.
1264 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 1264 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1265 1265 const IntPoint pointInContents =
1266 Element* editable = frame()->selection().rootEditableElement(); 1266 frame()->view()->viewportToContents(pointInViewport);
1267 if (!editable) 1267 frame()->selection().moveCaretSelection(pointInContents);
1268 return;
1269
1270 VisiblePosition position = visiblePositionForViewportPoint(pointInViewport);
1271 frame()->selection().moveTo(position, UserTriggered);
1272 } 1268 }
1273 1269
1274 bool WebLocalFrameImpl::setEditableSelectionOffsets(int start, int end) { 1270 bool WebLocalFrameImpl::setEditableSelectionOffsets(int start, int end) {
1275 TRACE_EVENT0("blink", "WebLocalFrameImpl::setEditableSelectionOffsets"); 1271 TRACE_EVENT0("blink", "WebLocalFrameImpl::setEditableSelectionOffsets");
1276 1272
1277 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets 1273 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets
1278 // needs to be audited. See http://crbug.com/590369 for more details. 1274 // needs to be audited. See http://crbug.com/590369 for more details.
1279 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets(); 1275 frame()->document()->updateStyleAndLayoutIgnorePendingStylesheets();
1280 1276
1281 return frame()->inputMethodController().setEditableSelectionOffsets( 1277 return frame()->inputMethodController().setEditableSelectionOffsets(
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after
2381 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol; 2377 feature = UseCounter::ChromeLoadTimesNpnNegotiatedProtocol;
2382 } else if (metric == "wasAlternateProtocolAvailable") { 2378 } else if (metric == "wasAlternateProtocolAvailable") {
2383 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable; 2379 feature = UseCounter::ChromeLoadTimesWasAlternateProtocolAvailable;
2384 } else if (metric == "connectionInfo") { 2380 } else if (metric == "connectionInfo") {
2385 feature = UseCounter::ChromeLoadTimesConnectionInfo; 2381 feature = UseCounter::ChromeLoadTimesConnectionInfo;
2386 } 2382 }
2387 UseCounter::count(frame(), feature); 2383 UseCounter::count(frame(), feature);
2388 } 2384 }
2389 2385
2390 } // namespace blink 2386 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/editing/FrameSelectionTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698