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

Side by Side Diff: Source/WebKit/chromium/src/WebViewImpl.cpp

Issue 6532004: DO NOT SUBMIT (Closed) Base URL: git://git.webkit.org/WebKit.git@master
Patch Set: Migrate WebTextHelper Created 9 years, 10 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) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 #include "WebInputEvent.h" 107 #include "WebInputEvent.h"
108 #include "WebInputEventConversion.h" 108 #include "WebInputEventConversion.h"
109 #include "WebKit.h" 109 #include "WebKit.h"
110 #include "WebKitClient.h" 110 #include "WebKitClient.h"
111 #include "WebMediaPlayerAction.h" 111 #include "WebMediaPlayerAction.h"
112 #include "WebNode.h" 112 #include "WebNode.h"
113 #include "WebPlugin.h" 113 #include "WebPlugin.h"
114 #include "WebPluginContainerImpl.h" 114 #include "WebPluginContainerImpl.h"
115 #include "WebPoint.h" 115 #include "WebPoint.h"
116 #include "WebPopupMenuImpl.h" 116 #include "WebPopupMenuImpl.h"
117 #include "WebRange.h"
117 #include "WebRect.h" 118 #include "WebRect.h"
118 #include "WebRuntimeFeatures.h" 119 #include "WebRuntimeFeatures.h"
119 #include "WebSettingsImpl.h" 120 #include "WebSettingsImpl.h"
120 #include "WebString.h" 121 #include "WebString.h"
121 #include "WebVector.h" 122 #include "WebVector.h"
122 #include "WebViewClient.h" 123 #include "WebViewClient.h"
123 #include <wtf/ByteArray.h> 124 #include <wtf/ByteArray.h>
124 #include <wtf/CurrentTime.h> 125 #include <wtf/CurrentTime.h>
125 #include <wtf/RefPtr.h> 126 #include <wtf/RefPtr.h>
126 127
(...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 if (text.length()) 1344 if (text.length())
1344 editor->confirmComposition(String(text)); 1345 editor->confirmComposition(String(text));
1345 else 1346 else
1346 editor->confirmComposition(); 1347 editor->confirmComposition();
1347 } else 1348 } else
1348 editor->insertText(String(text), 0); 1349 editor->insertText(String(text), 0);
1349 1350
1350 return true; 1351 return true;
1351 } 1352 }
1352 1353
1354 WebRange WebViewImpl::compositionRange()
1355 {
1356 Frame* focused = focusedWebCoreFrame();
1357 if (!focused || !m_imeAcceptEvents)
1358 return WebRange();
1359 Editor* editor = focused->editor();
1360 if (!editor || !editor->hasComposition())
1361 return WebRange();
1362 return editor->compositionRange();
1363 }
1364
1353 WebTextInputType WebViewImpl::textInputType() 1365 WebTextInputType WebViewImpl::textInputType()
1354 { 1366 {
1355 WebTextInputType type = WebTextInputTypeNone; 1367 WebTextInputType type = WebTextInputTypeNone;
1356 const Frame* focused = focusedWebCoreFrame(); 1368 const Frame* focused = focusedWebCoreFrame();
1357 if (!focused) 1369 if (!focused)
1358 return type; 1370 return type;
1359 1371
1360 const Editor* editor = focused->editor(); 1372 const Editor* editor = focused->editor();
1361 if (!editor || !editor->canEdit()) 1373 if (!editor || !editor->canEdit())
1362 return type; 1374 return type;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1403 else if (controller->isRange()) { 1415 else if (controller->isRange()) {
1404 node = controller->end().deprecatedNode(); 1416 node = controller->end().deprecatedNode();
1405 if (!node || !node->renderer()) 1417 if (!node || !node->renderer())
1406 return rect; 1418 return rect;
1407 RefPtr<Range> range = controller->toNormalizedRange(); 1419 RefPtr<Range> range = controller->toNormalizedRange();
1408 rect = view->contentsToWindow(focused->editor()->firstRectForRange(range .get())); 1420 rect = view->contentsToWindow(focused->editor()->firstRectForRange(range .get()));
1409 } 1421 }
1410 return rect; 1422 return rect;
1411 } 1423 }
1412 1424
1425 WebRange WebViewImpl::caretOrSelectionRange()
1426 {
1427 WebRange range;
1428 const Frame* focused = focusedWebCoreFrame();
1429 if (!focused)
1430 return range;
1431
1432 SelectionController* controller = focused->selection();
1433 if (!controller)
1434 return range;
1435
1436 return controller->toNormalizedRange();
1437 }
1438
1413 void WebViewImpl::setTextDirection(WebTextDirection direction) 1439 void WebViewImpl::setTextDirection(WebTextDirection direction)
1414 { 1440 {
1415 // The Editor::setBaseWritingDirection() function checks if we can change 1441 // The Editor::setBaseWritingDirection() function checks if we can change
1416 // the text direction of the selected node and updates its DOM "dir" 1442 // the text direction of the selected node and updates its DOM "dir"
1417 // attribute and its CSS "direction" property. 1443 // attribute and its CSS "direction" property.
1418 // So, we just call the function as Safari does. 1444 // So, we just call the function as Safari does.
1419 const Frame* focused = focusedWebCoreFrame(); 1445 const Frame* focused = focusedWebCoreFrame();
1420 if (!focused) 1446 if (!focused)
1421 return; 1447 return;
1422 1448
(...skipping 1018 matching lines...) Expand 10 before | Expand all | Expand 10 after
2441 m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size .width), std::max(1, m_size.height)); 2467 m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size .width), std::max(1, m_size.height));
2442 context = m_temporaryOnscreenGraphicsContext3D.get(); 2468 context = m_temporaryOnscreenGraphicsContext3D.get();
2443 } 2469 }
2444 return GraphicsContext3DInternal::extractWebGraphicsContext3D(context); 2470 return GraphicsContext3DInternal::extractWebGraphicsContext3D(context);
2445 } 2471 }
2446 #endif 2472 #endif
2447 return 0; 2473 return 0;
2448 } 2474 }
2449 2475
2450 } // namespace WebKit 2476 } // namespace WebKit
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698