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

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

Issue 201773005: Copy a few selection related methods to WebFrame from WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: update test Created 6 years, 9 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/web/WebFrameImpl.h ('k') | Source/web/WebViewImpl.h » ('j') | 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // triggering its deletion unless something else is still retaining a reference. 67 // triggering its deletion unless something else is still retaining a reference.
68 // 68 //
69 // Thie client is expected to be set whenever the WebFrameImpl is attached to 69 // Thie client is expected to be set whenever the WebFrameImpl is attached to
70 // the DOM. 70 // the DOM.
71 71
72 #include "config.h" 72 #include "config.h"
73 #include "WebFrameImpl.h" 73 #include "WebFrameImpl.h"
74 74
75 #include <algorithm> 75 #include <algorithm>
76 #include "AssociatedURLLoader.h" 76 #include "AssociatedURLLoader.h"
77 #include "CompositionUnderlineVectorBuilder.h"
77 #include "EventListenerWrapper.h" 78 #include "EventListenerWrapper.h"
78 #include "FindInPageCoordinates.h" 79 #include "FindInPageCoordinates.h"
79 #include "HTMLNames.h" 80 #include "HTMLNames.h"
80 #include "PageOverlay.h" 81 #include "PageOverlay.h"
81 #include "SharedWorkerRepositoryClientImpl.h" 82 #include "SharedWorkerRepositoryClientImpl.h"
82 #include "WebConsoleMessage.h" 83 #include "WebConsoleMessage.h"
83 #include "WebDOMEvent.h" 84 #include "WebDOMEvent.h"
84 #include "WebDOMEventListener.h" 85 #include "WebDOMEventListener.h"
85 #include "WebDataSourceImpl.h" 86 #include "WebDataSourceImpl.h"
86 #include "WebDevToolsAgentPrivate.h" 87 #include "WebDevToolsAgentPrivate.h"
(...skipping 1265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 void WebFrameImpl::moveCaretSelection(const WebPoint& point) 1353 void WebFrameImpl::moveCaretSelection(const WebPoint& point)
1353 { 1354 {
1354 Element* editable = frame()->selection().rootEditableElement(); 1355 Element* editable = frame()->selection().rootEditableElement();
1355 if (!editable) 1356 if (!editable)
1356 return; 1357 return;
1357 1358
1358 VisiblePosition position = visiblePositionForWindowPoint(point); 1359 VisiblePosition position = visiblePositionForWindowPoint(point);
1359 frame()->selection().moveTo(position, UserTriggered); 1360 frame()->selection().moveTo(position, UserTriggered);
1360 } 1361 }
1361 1362
1363 bool WebFrameImpl::setEditableSelectionOffsets(int start, int end)
1364 {
1365 return frame()->inputMethodController().setEditableSelectionOffsets(PlainTex tRange(start, end));
1366 }
1367
1368 bool WebFrameImpl::setCompositionFromExistingText(int compositionStart, int comp ositionEnd, const WebVector<WebCompositionUnderline>& underlines)
1369 {
1370 if (!frame()->editor().canEdit())
1371 return false;
1372
1373 InputMethodController& inputMethodController = frame()->inputMethodControlle r();
1374 inputMethodController.cancelComposition();
1375
1376 if (compositionStart == compositionEnd)
1377 return true;
1378
1379 inputMethodController.setCompositionFromExistingText(CompositionUnderlineVec torBuilder(underlines), compositionStart, compositionEnd);
1380
1381 return true;
1382 }
1383
1384 void WebFrameImpl::extendSelectionAndDelete(int before, int after)
1385 {
1386 if (WebPlugin* plugin = focusedPluginIfInputMethodSupported()) {
1387 plugin->extendSelectionAndDelete(before, after);
1388 return;
1389 }
1390 frame()->inputMethodController().extendSelectionAndDelete(before, after);
1391 }
1392
1362 void WebFrameImpl::setCaretVisible(bool visible) 1393 void WebFrameImpl::setCaretVisible(bool visible)
1363 { 1394 {
1364 frame()->selection().setCaretVisible(visible); 1395 frame()->selection().setCaretVisible(visible);
1365 } 1396 }
1366 1397
1367 VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin t) 1398 VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin t)
1368 { 1399 {
1369 FloatPoint unscaledPoint(point); 1400 FloatPoint unscaledPoint(point);
1370 unscaledPoint.scale(1 / view()->pageScaleFactor(), 1 / view()->pageScaleFact or()); 1401 unscaledPoint.scale(1 / view()->pageScaleFactor(), 1 / view()->pageScaleFact or());
1371 1402
1372 HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | H itTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::Confusi ngAndOftenMisusedDisallowShadowContent; 1403 HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | H itTestRequest::Active | HitTestRequest::IgnoreClipping | HitTestRequest::Confusi ngAndOftenMisusedDisallowShadowContent;
1373 HitTestResult result(frame()->view()->windowToContents(roundedIntPoint(unsca ledPoint))); 1404 HitTestResult result(frame()->view()->windowToContents(roundedIntPoint(unsca ledPoint)));
1374 frame()->document()->renderView()->layer()->hitTest(request, result); 1405 frame()->document()->renderView()->layer()->hitTest(request, result);
1375 1406
1376 if (Node* node = result.targetNode()) 1407 if (Node* node = result.targetNode())
1377 return frame()->selection().selection().visiblePositionRespectingEditing Boundary(result.localPoint(), node); 1408 return frame()->selection().selection().visiblePositionRespectingEditing Boundary(result.localPoint(), node);
1378 return VisiblePosition(); 1409 return VisiblePosition();
1379 } 1410 }
1380 1411
1412 WebPlugin* WebFrameImpl::focusedPluginIfInputMethodSupported()
1413 {
1414 WebPluginContainerImpl* container = WebFrameImpl::pluginContainerFromNode(fr ame(), WebNode(frame()->document()->focusedElement()));
1415 if (container && container->supportsInputMethod())
1416 return container->plugin();
1417 return 0;
1418 }
1419
1381 int WebFrameImpl::printBegin(const WebPrintParams& printParams, const WebNode& c onstrainToNode) 1420 int WebFrameImpl::printBegin(const WebPrintParams& printParams, const WebNode& c onstrainToNode)
1382 { 1421 {
1383 ASSERT(!frame()->document()->isFrameSet()); 1422 ASSERT(!frame()->document()->isFrameSet());
1384 WebPluginContainerImpl* pluginContainer = 0; 1423 WebPluginContainerImpl* pluginContainer = 0;
1385 if (constrainToNode.isNull()) { 1424 if (constrainToNode.isNull()) {
1386 // If this is a plugin document, check if the plugin supports its own 1425 // If this is a plugin document, check if the plugin supports its own
1387 // printing. If it does, we will delegate all printing to that. 1426 // printing. If it does, we will delegate all printing to that.
1388 pluginContainer = pluginContainerFromFrame(frame()); 1427 pluginContainer = pluginContainerFromFrame(frame());
1389 } else { 1428 } else {
1390 // We only support printing plugin nodes for now. 1429 // We only support printing plugin nodes for now.
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2496 2535
2497 // There is a possibility that the frame being detached was the only 2536 // There is a possibility that the frame being detached was the only
2498 // pending one. We need to make sure final replies can be sent. 2537 // pending one. We need to make sure final replies can be sent.
2499 flushCurrentScopingEffort(m_findRequestIdentifier); 2538 flushCurrentScopingEffort(m_findRequestIdentifier);
2500 2539
2501 cancelPendingScopingEffort(); 2540 cancelPendingScopingEffort();
2502 } 2541 }
2503 } 2542 }
2504 2543
2505 } // namespace blink 2544 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebFrameImpl.h ('k') | Source/web/WebViewImpl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698