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

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

Issue 1171733002: Adding a bunch of trace events for text selection. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@new_granularity_real
Patch Set: 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/FrameSelection.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 1255
1256 RefPtrWillBeRawPtr<Range> range = frame()->selection().toNormalizedRange(); 1256 RefPtrWillBeRawPtr<Range> range = frame()->selection().toNormalizedRange();
1257 if (!range) 1257 if (!range)
1258 return WebString(); 1258 return WebString();
1259 1259
1260 return createMarkup(range.get(), AnnotateForInterchange, ConvertBlocksToInli nes::NotConvert, ResolveNonLocalURLs); 1260 return createMarkup(range.get(), AnnotateForInterchange, ConvertBlocksToInli nes::NotConvert, ResolveNonLocalURLs);
1261 } 1261 }
1262 1262
1263 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosit ion position) 1263 void WebLocalFrameImpl::selectWordAroundPosition(LocalFrame* frame, VisiblePosit ion position)
1264 { 1264 {
1265 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectWordAroundPosition");
1265 frame->selection().selectWordAroundPosition(position); 1266 frame->selection().selectWordAroundPosition(position);
1266 } 1267 }
1267 1268
1268 bool WebLocalFrameImpl::selectWordAroundCaret() 1269 bool WebLocalFrameImpl::selectWordAroundCaret()
1269 { 1270 {
1271 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectWordAroundCaret");
1270 FrameSelection& selection = frame()->selection(); 1272 FrameSelection& selection = frame()->selection();
1271 if (selection.isNone() || selection.isRange()) 1273 if (selection.isNone() || selection.isRange())
1272 return false; 1274 return false;
1273 return frame()->selection().selectWordAroundPosition(selection.selection().v isibleStart()); 1275 return frame()->selection().selectWordAroundPosition(selection.selection().v isibleStart());
1274 } 1276 }
1275 1277
1276 void WebLocalFrameImpl::selectRange(const WebPoint& baseInViewport, const WebPoi nt& extentInViewport) 1278 void WebLocalFrameImpl::selectRange(const WebPoint& baseInViewport, const WebPoi nt& extentInViewport)
1277 { 1279 {
1278 moveRangeSelection(baseInViewport, extentInViewport); 1280 moveRangeSelection(baseInViewport, extentInViewport);
1279 } 1281 }
1280 1282
1281 void WebLocalFrameImpl::selectRange(const WebRange& webRange) 1283 void WebLocalFrameImpl::selectRange(const WebRange& webRange)
1282 { 1284 {
1285 TRACE_EVENT0("blink", "WebLocalFrameImpl::selectRange");
1283 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange)) 1286 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge>>(webRange))
1284 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered); 1287 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered);
1285 } 1288 }
1286 1289
1287 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point) 1290 void WebLocalFrameImpl::moveRangeSelectionExtent(const WebPoint& point)
1288 { 1291 {
1292 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelectionExtent");
1289 frame()->selection().moveRangeSelectionExtent(frame()->view()->viewportToCon tents(point)); 1293 frame()->selection().moveRangeSelectionExtent(frame()->view()->viewportToCon tents(point));
1290 } 1294 }
1291 1295
1292 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity) 1296 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& baseInViewport, const WebPoint& extentInViewport, WebFrame::TextGranularity granularity)
1293 { 1297 {
1298 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveRangeSelection");
1294 blink::TextGranularity blinkGranularity = blink::CharacterGranularity; 1299 blink::TextGranularity blinkGranularity = blink::CharacterGranularity;
1295 if (granularity == WebFrame::WordGranularity) 1300 if (granularity == WebFrame::WordGranularity)
1296 blinkGranularity = blink::WordGranularity; 1301 blinkGranularity = blink::WordGranularity;
1297 frame()->selection().moveRangeSelection( 1302 frame()->selection().moveRangeSelection(
1298 visiblePositionForViewportPoint(baseInViewport), 1303 visiblePositionForViewportPoint(baseInViewport),
1299 visiblePositionForViewportPoint(extentInViewport), 1304 visiblePositionForViewportPoint(extentInViewport),
1300 blinkGranularity); 1305 blinkGranularity);
1301 } 1306 }
1302 1307
1303 void WebLocalFrameImpl::moveCaretSelection(const WebPoint& pointInViewport) 1308 void WebLocalFrameImpl::moveCaretSelection(const WebPoint& pointInViewport)
1304 { 1309 {
1310 TRACE_EVENT0("blink", "WebLocalFrameImpl::moveCaretSelection");
1305 Element* editable = frame()->selection().rootEditableElement(); 1311 Element* editable = frame()->selection().rootEditableElement();
1306 if (!editable) 1312 if (!editable)
1307 return; 1313 return;
1308 1314
1309 VisiblePosition position = visiblePositionForViewportPoint(pointInViewport); 1315 VisiblePosition position = visiblePositionForViewportPoint(pointInViewport);
1310 frame()->selection().moveTo(position, UserTriggered); 1316 frame()->selection().moveTo(position, UserTriggered);
1311 } 1317 }
1312 1318
1313 bool WebLocalFrameImpl::setEditableSelectionOffsets(int start, int end) 1319 bool WebLocalFrameImpl::setEditableSelectionOffsets(int start, int end)
1314 { 1320 {
1321 TRACE_EVENT0("blink", "WebLocalFrameImpl::setEditableSelectionOffsets");
1315 return frame()->inputMethodController().setEditableSelectionOffsets(PlainTex tRange(start, end)); 1322 return frame()->inputMethodController().setEditableSelectionOffsets(PlainTex tRange(start, end));
1316 } 1323 }
1317 1324
1318 bool WebLocalFrameImpl::setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines) 1325 bool WebLocalFrameImpl::setCompositionFromExistingText(int compositionStart, int compositionEnd, const WebVector<WebCompositionUnderline>& underlines)
1319 { 1326 {
1327 TRACE_EVENT0("blink", "WebLocalFrameImpl::setCompositionFromExistingText");
1320 if (!frame()->editor().canEdit()) 1328 if (!frame()->editor().canEdit())
1321 return false; 1329 return false;
1322 1330
1323 InputMethodController& inputMethodController = frame()->inputMethodControlle r(); 1331 InputMethodController& inputMethodController = frame()->inputMethodControlle r();
1324 inputMethodController.cancelComposition(); 1332 inputMethodController.cancelComposition();
1325 1333
1326 if (compositionStart == compositionEnd) 1334 if (compositionStart == compositionEnd)
1327 return true; 1335 return true;
1328 1336
1329 inputMethodController.setCompositionFromExistingText(CompositionUnderlineVec torBuilder(underlines), compositionStart, compositionEnd); 1337 inputMethodController.setCompositionFromExistingText(CompositionUnderlineVec torBuilder(underlines), compositionStart, compositionEnd);
1330 1338
1331 return true; 1339 return true;
1332 } 1340 }
1333 1341
1334 void WebLocalFrameImpl::extendSelectionAndDelete(int before, int after) 1342 void WebLocalFrameImpl::extendSelectionAndDelete(int before, int after)
1335 { 1343 {
1344 TRACE_EVENT0("blink", "WebLocalFrameImpl::extendSelectionAndDelete");
1336 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) { 1345 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) {
1337 plugin->extendSelectionAndDelete(before, after); 1346 plugin->extendSelectionAndDelete(before, after);
1338 return; 1347 return;
1339 } 1348 }
1340 frame()->inputMethodController().extendSelectionAndDelete(before, after); 1349 frame()->inputMethodController().extendSelectionAndDelete(before, after);
1341 } 1350 }
1342 1351
1343 void WebLocalFrameImpl::setCaretVisible(bool visible) 1352 void WebLocalFrameImpl::setCaretVisible(bool visible)
1344 { 1353 {
1345 frame()->selection().setCaretVisible(visible); 1354 frame()->selection().setCaretVisible(visible);
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 { 2111 {
2103 m_frameWidget = frameWidget; 2112 m_frameWidget = frameWidget;
2104 } 2113 }
2105 2114
2106 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const 2115 WebFrameWidgetImpl* WebLocalFrameImpl::frameWidget() const
2107 { 2116 {
2108 return m_frameWidget; 2117 return m_frameWidget;
2109 } 2118 }
2110 2119
2111 } // namespace blink 2120 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/FrameSelection.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698