OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1461 unsigned numEnclosingMailBlockquotes(const Position& p) | 1461 unsigned numEnclosingMailBlockquotes(const Position& p) |
1462 { | 1462 { |
1463 unsigned num = 0; | 1463 unsigned num = 0; |
1464 for (Node* n = p.anchorNode(); n; n = n->parentNode()) { | 1464 for (Node* n = p.anchorNode(); n; n = n->parentNode()) { |
1465 if (isMailHTMLBlockquoteElement(n)) | 1465 if (isMailHTMLBlockquoteElement(n)) |
1466 num++; | 1466 num++; |
1467 } | 1467 } |
1468 return num; | 1468 return num; |
1469 } | 1469 } |
1470 | 1470 |
| 1471 PositionWithAffinity positionRespectingEditingBoundary(const Position& position,
const LayoutPoint& localPoint, Node* targetNode) |
| 1472 { |
| 1473 if (!targetNode->layoutObject()) |
| 1474 return PositionWithAffinity(); |
| 1475 |
| 1476 LayoutPoint selectionEndPoint = localPoint; |
| 1477 Element* editableElement = rootEditableElementOf(position); |
| 1478 |
| 1479 if (editableElement && !editableElement->contains(targetNode)) { |
| 1480 if (!editableElement->layoutObject()) |
| 1481 return PositionWithAffinity(); |
| 1482 |
| 1483 FloatPoint absolutePoint = targetNode->layoutObject()->localToAbsolute(F
loatPoint(selectionEndPoint)); |
| 1484 selectionEndPoint = roundedLayoutPoint(editableElement->layoutObject()->
absoluteToLocal(absolutePoint)); |
| 1485 targetNode = editableElement; |
| 1486 } |
| 1487 |
| 1488 return targetNode->layoutObject()->positionForPoint(selectionEndPoint); |
| 1489 } |
| 1490 |
1471 void updatePositionForNodeRemoval(Position& position, Node& node) | 1491 void updatePositionForNodeRemoval(Position& position, Node& node) |
1472 { | 1492 { |
1473 if (position.isNull()) | 1493 if (position.isNull()) |
1474 return; | 1494 return; |
1475 switch (position.anchorType()) { | 1495 switch (position.anchorType()) { |
1476 case PositionAnchorType::BeforeChildren: | 1496 case PositionAnchorType::BeforeChildren: |
1477 if (node.isShadowIncludingInclusiveAncestorOf(position.computeContainerN
ode())) | 1497 if (node.isShadowIncludingInclusiveAncestorOf(position.computeContainerN
ode())) |
1478 position = Position::inParentBeforeNode(node); | 1498 position = Position::inParentBeforeNode(node); |
1479 break; | 1499 break; |
1480 case PositionAnchorType::AfterChildren: | 1500 case PositionAnchorType::AfterChildren: |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1760 { | 1780 { |
1761 if (!RuntimeEnabledFeatures::inputEventEnabled()) | 1781 if (!RuntimeEnabledFeatures::inputEventEnabled()) |
1762 return DispatchEventResult::NotCanceled; | 1782 return DispatchEventResult::NotCanceled; |
1763 if (!target) | 1783 if (!target) |
1764 return DispatchEventResult::NotCanceled; | 1784 return DispatchEventResult::NotCanceled; |
1765 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data
, InputEvent::EventCancelable::IsCancelable, InputEvent::EventIsComposing::NotCo
mposing); | 1785 InputEvent* beforeInputEvent = InputEvent::createBeforeInput(inputType, data
, InputEvent::EventCancelable::IsCancelable, InputEvent::EventIsComposing::NotCo
mposing); |
1766 return target->dispatchEvent(beforeInputEvent); | 1786 return target->dispatchEvent(beforeInputEvent); |
1767 } | 1787 } |
1768 | 1788 |
1769 } // namespace blink | 1789 } // namespace blink |
OLD | NEW |