OLD | NEW |
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 Loading... |
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 "cc/CCHeadsUpDisplay.h" | 124 #include "cc/CCHeadsUpDisplay.h" |
124 #include <wtf/ByteArray.h> | 125 #include <wtf/ByteArray.h> |
125 #include <wtf/CurrentTime.h> | 126 #include <wtf/CurrentTime.h> |
126 #include <wtf/RefPtr.h> | 127 #include <wtf/RefPtr.h> |
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1377 if (text.length()) | 1378 if (text.length()) |
1378 editor->confirmComposition(String(text)); | 1379 editor->confirmComposition(String(text)); |
1379 else | 1380 else |
1380 editor->confirmComposition(); | 1381 editor->confirmComposition(); |
1381 } else | 1382 } else |
1382 editor->insertText(String(text), 0); | 1383 editor->insertText(String(text), 0); |
1383 | 1384 |
1384 return true; | 1385 return true; |
1385 } | 1386 } |
1386 | 1387 |
| 1388 bool WebViewImpl::compositionRange(unsigned* location, unsigned* length) |
| 1389 { |
| 1390 Frame* focused = focusedWebCoreFrame(); |
| 1391 if (!focused || !m_imeAcceptEvents) |
| 1392 return false; |
| 1393 Editor* editor = focused->editor(); |
| 1394 if (!editor || !editor->hasComposition()) |
| 1395 return false; |
| 1396 |
| 1397 RefPtr<Range> range = editor->compositionRange(); |
| 1398 if (!range.get()) |
| 1399 return false; |
| 1400 |
| 1401 if (range->getLocationAndLength(*location, *length)) |
| 1402 return true; |
| 1403 return false; |
| 1404 } |
| 1405 |
1387 WebTextInputType WebViewImpl::textInputType() | 1406 WebTextInputType WebViewImpl::textInputType() |
1388 { | 1407 { |
1389 WebTextInputType type = WebTextInputTypeNone; | 1408 WebTextInputType type = WebTextInputTypeNone; |
1390 const Frame* focused = focusedWebCoreFrame(); | 1409 const Frame* focused = focusedWebCoreFrame(); |
1391 if (!focused) | 1410 if (!focused) |
1392 return type; | 1411 return type; |
1393 | 1412 |
1394 const Editor* editor = focused->editor(); | 1413 const Editor* editor = focused->editor(); |
1395 if (!editor || !editor->canEdit()) | 1414 if (!editor || !editor->canEdit()) |
1396 return type; | 1415 return type; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 else if (controller->isRange()) { | 1456 else if (controller->isRange()) { |
1438 node = controller->end().deprecatedNode(); | 1457 node = controller->end().deprecatedNode(); |
1439 if (!node || !node->renderer()) | 1458 if (!node || !node->renderer()) |
1440 return rect; | 1459 return rect; |
1441 RefPtr<Range> range = controller->toNormalizedRange(); | 1460 RefPtr<Range> range = controller->toNormalizedRange(); |
1442 rect = view->contentsToWindow(focused->editor()->firstRectForRange(range
.get())); | 1461 rect = view->contentsToWindow(focused->editor()->firstRectForRange(range
.get())); |
1443 } | 1462 } |
1444 return rect; | 1463 return rect; |
1445 } | 1464 } |
1446 | 1465 |
| 1466 bool WebViewImpl::caretOrSelectionRange(unsigned* location, unsigned* length) |
| 1467 { |
| 1468 const Frame* focused = focusedWebCoreFrame(); |
| 1469 if (!focused) |
| 1470 return false; |
| 1471 |
| 1472 SelectionController* controller = focused->selection(); |
| 1473 if (!controller) |
| 1474 return false; |
| 1475 |
| 1476 RefPtr<Range> range = controller->selection().firstRange(); |
| 1477 if (!range.get()) |
| 1478 return false; |
| 1479 |
| 1480 if (range->getLocationAndLength(*location, *length)) |
| 1481 return true; |
| 1482 return false; |
| 1483 } |
| 1484 |
1447 void WebViewImpl::setTextDirection(WebTextDirection direction) | 1485 void WebViewImpl::setTextDirection(WebTextDirection direction) |
1448 { | 1486 { |
1449 // The Editor::setBaseWritingDirection() function checks if we can change | 1487 // The Editor::setBaseWritingDirection() function checks if we can change |
1450 // the text direction of the selected node and updates its DOM "dir" | 1488 // the text direction of the selected node and updates its DOM "dir" |
1451 // attribute and its CSS "direction" property. | 1489 // attribute and its CSS "direction" property. |
1452 // So, we just call the function as Safari does. | 1490 // So, we just call the function as Safari does. |
1453 const Frame* focused = focusedWebCoreFrame(); | 1491 const Frame* focused = focusedWebCoreFrame(); |
1454 if (!focused) | 1492 if (!focused) |
1455 return; | 1493 return; |
1456 | 1494 |
(...skipping 1056 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2513 m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size
.width), std::max(1, m_size.height)); | 2551 m_temporaryOnscreenGraphicsContext3D->reshape(std::max(1, m_size
.width), std::max(1, m_size.height)); |
2514 context = m_temporaryOnscreenGraphicsContext3D.get(); | 2552 context = m_temporaryOnscreenGraphicsContext3D.get(); |
2515 } | 2553 } |
2516 return GraphicsContext3DInternal::extractWebGraphicsContext3D(context); | 2554 return GraphicsContext3DInternal::extractWebGraphicsContext3D(context); |
2517 } | 2555 } |
2518 #endif | 2556 #endif |
2519 return 0; | 2557 return 0; |
2520 } | 2558 } |
2521 | 2559 |
2522 } // namespace WebKit | 2560 } // namespace WebKit |
OLD | NEW |