OLD | NEW |
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 1370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1381 if (frame()->selection()->shouldChangeSelection(newSelection)) | 1381 if (frame()->selection()->shouldChangeSelection(newSelection)) |
1382 frame()->selection()->setSelection(newSelection, CharacterGranularity); | 1382 frame()->selection()->setSelection(newSelection, CharacterGranularity); |
1383 } | 1383 } |
1384 | 1384 |
1385 void WebFrameImpl::selectRange(const WebRange& webRange) | 1385 void WebFrameImpl::selectRange(const WebRange& webRange) |
1386 { | 1386 { |
1387 if (RefPtr<Range> range = static_cast<PassRefPtr<Range> >(webRange)) | 1387 if (RefPtr<Range> range = static_cast<PassRefPtr<Range> >(webRange)) |
1388 frame()->selection()->setSelectedRange(range.get(), WebCore::VP_DEFAULT_
AFFINITY, false); | 1388 frame()->selection()->setSelectedRange(range.get(), WebCore::VP_DEFAULT_
AFFINITY, false); |
1389 } | 1389 } |
1390 | 1390 |
| 1391 void WebFrameImpl::moveCaretSelectionTowardsWindowPoint(const WebPoint& point) |
| 1392 { |
| 1393 Element* editable = frame()->selection()->rootEditableElement(); |
| 1394 IntPoint contentsPoint = frame()->view()->windowToContents(IntPoint(point)); |
| 1395 LayoutPoint localPoint(editable->convertFromPage(contentsPoint)); |
| 1396 VisiblePosition position = editable->renderer()->positionForPoint(localPoint
); |
| 1397 if (frame()->selection()->shouldChangeSelection(position)) |
| 1398 frame()->selection()->moveTo(position, UserTriggered); |
| 1399 } |
| 1400 |
1391 VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin
t) | 1401 VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& poin
t) |
1392 { | 1402 { |
1393 HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | H
itTestRequest::Active | HitTestRequest::IgnoreClipping; | 1403 HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | H
itTestRequest::Active | HitTestRequest::IgnoreClipping; |
1394 HitTestResult result(frame()->view()->windowToContents(IntPoint(point))); | 1404 HitTestResult result(frame()->view()->windowToContents(IntPoint(point))); |
1395 | 1405 |
1396 frame()->document()->renderView()->layer()->hitTest(request, result); | 1406 frame()->document()->renderView()->layer()->hitTest(request, result); |
1397 | 1407 |
1398 Node* node = result.targetNode(); | 1408 Node* node = result.targetNode(); |
1399 if (!node) | 1409 if (!node) |
1400 return VisiblePosition(); | 1410 return VisiblePosition(); |
(...skipping 1137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2538 | 2548 |
2539 // There is a possibility that the frame being detached was the only | 2549 // There is a possibility that the frame being detached was the only |
2540 // pending one. We need to make sure final replies can be sent. | 2550 // pending one. We need to make sure final replies can be sent. |
2541 flushCurrentScopingEffort(m_findRequestIdentifier); | 2551 flushCurrentScopingEffort(m_findRequestIdentifier); |
2542 | 2552 |
2543 cancelPendingScopingEffort(); | 2553 cancelPendingScopingEffort(); |
2544 } | 2554 } |
2545 } | 2555 } |
2546 | 2556 |
2547 } // namespace WebKit | 2557 } // namespace WebKit |
OLD | NEW |