| 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 1014 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1025 layoutObject->style()->display() == EDisplay::InlineTable) | 1025 layoutObject->style()->display() == EDisplay::InlineTable) |
| 1026 return true; | 1026 return true; |
| 1027 | 1027 |
| 1028 if (layoutObject->style()->isFloating()) | 1028 if (layoutObject->style()->isFloating()) |
| 1029 return true; | 1029 return true; |
| 1030 | 1030 |
| 1031 return false; | 1031 return false; |
| 1032 } | 1032 } |
| 1033 | 1033 |
| 1034 static HTMLElement* firstInSpecialElement(const Position& pos) { | 1034 static HTMLElement* firstInSpecialElement(const Position& pos) { |
| 1035 DCHECK(!needsLayoutTreeUpdate(pos)); |
| 1035 Element* element = rootEditableElement(*pos.computeContainerNode()); | 1036 Element* element = rootEditableElement(*pos.computeContainerNode()); |
| 1036 for (Node& runner : NodeTraversal::inclusiveAncestorsOf(*pos.anchorNode())) { | 1037 for (Node& runner : NodeTraversal::inclusiveAncestorsOf(*pos.anchorNode())) { |
| 1037 if (rootEditableElement(runner) != element) | 1038 if (rootEditableElement(runner) != element) |
| 1038 break; | 1039 break; |
| 1039 if (isSpecialHTMLElement(runner)) { | 1040 if (isSpecialHTMLElement(runner)) { |
| 1040 HTMLElement* specialElement = toHTMLElement(&runner); | 1041 HTMLElement* specialElement = toHTMLElement(&runner); |
| 1041 VisiblePosition vPos = createVisiblePositionDeprecated(pos); | 1042 VisiblePosition vPos = createVisiblePosition(pos); |
| 1042 VisiblePosition firstInElement = createVisiblePositionDeprecated( | 1043 VisiblePosition firstInElement = |
| 1043 firstPositionInOrBeforeNode(specialElement)); | 1044 createVisiblePosition(firstPositionInOrBeforeNode(specialElement)); |
| 1044 if (isDisplayInsideTable(specialElement) && | 1045 if (isDisplayInsideTable(specialElement) && |
| 1045 vPos.deepEquivalent() == | 1046 vPos.deepEquivalent() == |
| 1046 nextPositionOf(firstInElement).deepEquivalent()) | 1047 nextPositionOf(firstInElement).deepEquivalent()) |
| 1047 return specialElement; | 1048 return specialElement; |
| 1048 if (vPos.deepEquivalent() == firstInElement.deepEquivalent()) | 1049 if (vPos.deepEquivalent() == firstInElement.deepEquivalent()) |
| 1049 return specialElement; | 1050 return specialElement; |
| 1050 } | 1051 } |
| 1051 } | 1052 } |
| 1052 return 0; | 1053 return 0; |
| 1053 } | 1054 } |
| 1054 | 1055 |
| 1055 static HTMLElement* lastInSpecialElement(const Position& pos) { | 1056 static HTMLElement* lastInSpecialElement(const Position& pos) { |
| 1057 DCHECK(!needsLayoutTreeUpdate(pos)); |
| 1056 Element* element = rootEditableElement(*pos.computeContainerNode()); | 1058 Element* element = rootEditableElement(*pos.computeContainerNode()); |
| 1057 for (Node& runner : NodeTraversal::inclusiveAncestorsOf(*pos.anchorNode())) { | 1059 for (Node& runner : NodeTraversal::inclusiveAncestorsOf(*pos.anchorNode())) { |
| 1058 if (rootEditableElement(runner) != element) | 1060 if (rootEditableElement(runner) != element) |
| 1059 break; | 1061 break; |
| 1060 if (isSpecialHTMLElement(runner)) { | 1062 if (isSpecialHTMLElement(runner)) { |
| 1061 HTMLElement* specialElement = toHTMLElement(&runner); | 1063 HTMLElement* specialElement = toHTMLElement(&runner); |
| 1062 VisiblePosition vPos = createVisiblePositionDeprecated(pos); | 1064 VisiblePosition vPos = createVisiblePosition(pos); |
| 1063 VisiblePosition lastInElement = createVisiblePositionDeprecated( | 1065 VisiblePosition lastInElement = |
| 1064 lastPositionInOrAfterNode(specialElement)); | 1066 createVisiblePosition(lastPositionInOrAfterNode(specialElement)); |
| 1065 if (isDisplayInsideTable(specialElement) && | 1067 if (isDisplayInsideTable(specialElement) && |
| 1066 vPos.deepEquivalent() == | 1068 vPos.deepEquivalent() == |
| 1067 previousPositionOf(lastInElement).deepEquivalent()) | 1069 previousPositionOf(lastInElement).deepEquivalent()) |
| 1068 return specialElement; | 1070 return specialElement; |
| 1069 if (vPos.deepEquivalent() == lastInElement.deepEquivalent()) | 1071 if (vPos.deepEquivalent() == lastInElement.deepEquivalent()) |
| 1070 return specialElement; | 1072 return specialElement; |
| 1071 } | 1073 } |
| 1072 } | 1074 } |
| 1073 return 0; | 1075 return 0; |
| 1074 } | 1076 } |
| 1075 | 1077 |
| 1076 Position positionBeforeContainingSpecialElement( | 1078 Position positionBeforeContainingSpecialElement( |
| 1077 const Position& pos, | 1079 const Position& pos, |
| 1078 HTMLElement** containingSpecialElement) { | 1080 HTMLElement** containingSpecialElement) { |
| 1081 DCHECK(!needsLayoutTreeUpdate(pos)); |
| 1079 HTMLElement* n = firstInSpecialElement(pos); | 1082 HTMLElement* n = firstInSpecialElement(pos); |
| 1080 if (!n) | 1083 if (!n) |
| 1081 return pos; | 1084 return pos; |
| 1082 Position result = Position::inParentBeforeNode(*n); | 1085 Position result = Position::inParentBeforeNode(*n); |
| 1083 if (result.isNull() || | 1086 if (result.isNull() || |
| 1084 rootEditableElement(*result.anchorNode()) != | 1087 rootEditableElement(*result.anchorNode()) != |
| 1085 rootEditableElement(*pos.anchorNode())) | 1088 rootEditableElement(*pos.anchorNode())) |
| 1086 return pos; | 1089 return pos; |
| 1087 if (containingSpecialElement) | 1090 if (containingSpecialElement) |
| 1088 *containingSpecialElement = n; | 1091 *containingSpecialElement = n; |
| 1089 return result; | 1092 return result; |
| 1090 } | 1093 } |
| 1091 | 1094 |
| 1092 Position positionAfterContainingSpecialElement( | 1095 Position positionAfterContainingSpecialElement( |
| 1093 const Position& pos, | 1096 const Position& pos, |
| 1094 HTMLElement** containingSpecialElement) { | 1097 HTMLElement** containingSpecialElement) { |
| 1098 DCHECK(!needsLayoutTreeUpdate(pos)); |
| 1095 HTMLElement* n = lastInSpecialElement(pos); | 1099 HTMLElement* n = lastInSpecialElement(pos); |
| 1096 if (!n) | 1100 if (!n) |
| 1097 return pos; | 1101 return pos; |
| 1098 Position result = Position::inParentAfterNode(*n); | 1102 Position result = Position::inParentAfterNode(*n); |
| 1099 if (result.isNull() || | 1103 if (result.isNull() || |
| 1100 rootEditableElement(*result.anchorNode()) != | 1104 rootEditableElement(*result.anchorNode()) != |
| 1101 rootEditableElement(*pos.anchorNode())) | 1105 rootEditableElement(*pos.anchorNode())) |
| 1102 return pos; | 1106 return pos; |
| 1103 if (containingSpecialElement) | 1107 if (containingSpecialElement) |
| 1104 *containingSpecialElement = n; | 1108 *containingSpecialElement = n; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1175 while (node) { | 1179 while (node) { |
| 1176 if (isAtomicNode(node)) | 1180 if (isAtomicNode(node)) |
| 1177 return node; | 1181 return node; |
| 1178 node = nextNodeConsideringAtomicNodes(*node); | 1182 node = nextNodeConsideringAtomicNodes(*node); |
| 1179 } | 1183 } |
| 1180 return nullptr; | 1184 return nullptr; |
| 1181 } | 1185 } |
| 1182 | 1186 |
| 1183 // Returns the visible position at the beginning of a node | 1187 // Returns the visible position at the beginning of a node |
| 1184 VisiblePosition visiblePositionBeforeNode(Node& node) { | 1188 VisiblePosition visiblePositionBeforeNode(Node& node) { |
| 1189 DCHECK(!needsLayoutTreeUpdate(node)); |
| 1185 if (node.hasChildren()) | 1190 if (node.hasChildren()) |
| 1186 return createVisiblePositionDeprecated(firstPositionInOrBeforeNode(&node)); | 1191 return createVisiblePosition(firstPositionInOrBeforeNode(&node)); |
| 1187 DCHECK(node.parentNode()) << node; | 1192 DCHECK(node.parentNode()) << node; |
| 1188 DCHECK(!node.parentNode()->isShadowRoot()) << node.parentNode(); | 1193 DCHECK(!node.parentNode()->isShadowRoot()) << node.parentNode(); |
| 1189 return VisiblePosition::inParentBeforeNode(node); | 1194 return VisiblePosition::inParentBeforeNode(node); |
| 1190 } | 1195 } |
| 1191 | 1196 |
| 1192 // Returns the visible position at the ending of a node | 1197 // Returns the visible position at the ending of a node |
| 1193 VisiblePosition visiblePositionAfterNode(Node& node) { | 1198 VisiblePosition visiblePositionAfterNode(Node& node) { |
| 1199 DCHECK(!needsLayoutTreeUpdate(node)); |
| 1194 if (node.hasChildren()) | 1200 if (node.hasChildren()) |
| 1195 return createVisiblePositionDeprecated(lastPositionInOrAfterNode(&node)); | 1201 return createVisiblePosition(lastPositionInOrAfterNode(&node)); |
| 1196 DCHECK(node.parentNode()) << node.parentNode(); | 1202 DCHECK(node.parentNode()) << node.parentNode(); |
| 1197 DCHECK(!node.parentNode()->isShadowRoot()) << node.parentNode(); | 1203 DCHECK(!node.parentNode()->isShadowRoot()) << node.parentNode(); |
| 1198 return VisiblePosition::inParentAfterNode(node); | 1204 return VisiblePosition::inParentAfterNode(node); |
| 1199 } | 1205 } |
| 1200 | 1206 |
| 1201 bool isHTMLListElement(Node* n) { | 1207 bool isHTMLListElement(Node* n) { |
| 1202 return (n && (isHTMLUListElement(*n) || isHTMLOListElement(*n) || | 1208 return (n && (isHTMLUListElement(*n) || isHTMLOListElement(*n) || |
| 1203 isHTMLDListElement(*n))); | 1209 isHTMLDListElement(*n))); |
| 1204 } | 1210 } |
| 1205 | 1211 |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1423 break; | 1429 break; |
| 1424 list = nextList; | 1430 list = nextList; |
| 1425 } | 1431 } |
| 1426 | 1432 |
| 1427 return list; | 1433 return list; |
| 1428 } | 1434 } |
| 1429 | 1435 |
| 1430 // Determines whether two positions are visibly next to each other (first then | 1436 // Determines whether two positions are visibly next to each other (first then |
| 1431 // second) while ignoring whitespaces and unrendered nodes | 1437 // second) while ignoring whitespaces and unrendered nodes |
| 1432 static bool isVisiblyAdjacent(const Position& first, const Position& second) { | 1438 static bool isVisiblyAdjacent(const Position& first, const Position& second) { |
| 1433 return createVisiblePositionDeprecated(first).deepEquivalent() == | 1439 return createVisiblePosition(first).deepEquivalent() == |
| 1434 createVisiblePositionDeprecated(mostBackwardCaretPosition(second)) | 1440 createVisiblePosition(mostBackwardCaretPosition(second)) |
| 1435 .deepEquivalent(); | 1441 .deepEquivalent(); |
| 1436 } | 1442 } |
| 1437 | 1443 |
| 1438 bool canMergeLists(Element* firstList, Element* secondList) { | 1444 bool canMergeLists(Element* firstList, Element* secondList) { |
| 1439 if (!firstList || !secondList || !firstList->isHTMLElement() || | 1445 if (!firstList || !secondList || !firstList->isHTMLElement() || |
| 1440 !secondList->isHTMLElement()) | 1446 !secondList->isHTMLElement()) |
| 1441 return false; | 1447 return false; |
| 1442 | 1448 |
| 1449 DCHECK(!needsLayoutTreeUpdate(*firstList)); |
| 1450 DCHECK(!needsLayoutTreeUpdate(*secondList)); |
| 1443 return firstList->hasTagName( | 1451 return firstList->hasTagName( |
| 1444 secondList | 1452 secondList |
| 1445 ->tagQName()) // make sure the list types match (ol vs. ul) | 1453 ->tagQName()) // make sure the list types match (ol vs. ul) |
| 1446 && hasEditableStyle(*firstList) && | 1454 && hasEditableStyle(*firstList) && |
| 1447 hasEditableStyle(*secondList) // both lists are editable | 1455 hasEditableStyle(*secondList) // both lists are editable |
| 1448 && | 1456 && |
| 1449 rootEditableElement(*firstList) == | 1457 rootEditableElement(*firstList) == |
| 1450 rootEditableElement(*secondList) // don't cross editing boundaries | 1458 rootEditableElement(*secondList) // don't cross editing boundaries |
| 1451 && isVisiblyAdjacent(Position::inParentAfterNode(*firstList), | 1459 && isVisiblyAdjacent(Position::inParentAfterNode(*firstList), |
| 1452 Position::inParentBeforeNode(*secondList)); | 1460 Position::inParentBeforeNode(*secondList)); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 if (!layoutObject) | 1576 if (!layoutObject) |
| 1569 return false; | 1577 return false; |
| 1570 | 1578 |
| 1571 return layoutObject->style()->visibility() == EVisibility::Visible; | 1579 return layoutObject->style()->visibility() == EVisibility::Visible; |
| 1572 } | 1580 } |
| 1573 | 1581 |
| 1574 // return first preceding DOM position rendered at a different location, or | 1582 // return first preceding DOM position rendered at a different location, or |
| 1575 // "this" | 1583 // "this" |
| 1576 static Position previousCharacterPosition(const Position& position, | 1584 static Position previousCharacterPosition(const Position& position, |
| 1577 TextAffinity affinity) { | 1585 TextAffinity affinity) { |
| 1586 DCHECK(!needsLayoutTreeUpdate(position)); |
| 1578 if (position.isNull()) | 1587 if (position.isNull()) |
| 1579 return Position(); | 1588 return Position(); |
| 1580 | 1589 |
| 1581 Element* fromRootEditableElement = | 1590 Element* fromRootEditableElement = |
| 1582 rootEditableElement(*position.anchorNode()); | 1591 rootEditableElement(*position.anchorNode()); |
| 1583 | 1592 |
| 1584 bool atStartOfLine = | 1593 bool atStartOfLine = isStartOfLine(createVisiblePosition(position, affinity)); |
| 1585 isStartOfLine(createVisiblePositionDeprecated(position, affinity)); | |
| 1586 bool rendered = isVisuallyEquivalentCandidate(position); | 1594 bool rendered = isVisuallyEquivalentCandidate(position); |
| 1587 | 1595 |
| 1588 Position currentPos = position; | 1596 Position currentPos = position; |
| 1589 while (!currentPos.atStartOfTree()) { | 1597 while (!currentPos.atStartOfTree()) { |
| 1590 // TODO(yosin) When we use |previousCharacterPosition()| other than | 1598 // TODO(yosin) When we use |previousCharacterPosition()| other than |
| 1591 // finding leading whitespace, we should use |Character| instead of | 1599 // finding leading whitespace, we should use |Character| instead of |
| 1592 // |CodePoint|. | 1600 // |CodePoint|. |
| 1593 currentPos = previousPositionOf(currentPos, PositionMoveType::CodeUnit); | 1601 currentPos = previousPositionOf(currentPos, PositionMoveType::CodeUnit); |
| 1594 | 1602 |
| 1595 if (rootEditableElement(*currentPos.anchorNode()) != | 1603 if (rootEditableElement(*currentPos.anchorNode()) != |
| 1596 fromRootEditableElement) | 1604 fromRootEditableElement) |
| 1597 return position; | 1605 return position; |
| 1598 | 1606 |
| 1599 if (atStartOfLine || !rendered) { | 1607 if (atStartOfLine || !rendered) { |
| 1600 if (isVisuallyEquivalentCandidate(currentPos)) | 1608 if (isVisuallyEquivalentCandidate(currentPos)) |
| 1601 return currentPos; | 1609 return currentPos; |
| 1602 } else if (rendersInDifferentPosition(position, currentPos)) { | 1610 } else if (rendersInDifferentPosition(position, currentPos)) { |
| 1603 return currentPos; | 1611 return currentPos; |
| 1604 } | 1612 } |
| 1605 } | 1613 } |
| 1606 | 1614 |
| 1607 return position; | 1615 return position; |
| 1608 } | 1616 } |
| 1609 | 1617 |
| 1610 // This assumes that it starts in editable content. | 1618 // This assumes that it starts in editable content. |
| 1611 Position leadingWhitespacePosition(const Position& position, | 1619 Position leadingWhitespacePosition(const Position& position, |
| 1612 TextAffinity affinity, | 1620 TextAffinity affinity, |
| 1613 WhitespacePositionOption option) { | 1621 WhitespacePositionOption option) { |
| 1622 DCHECK(!needsLayoutTreeUpdate(position)); |
| 1614 DCHECK(isEditablePosition(position)) << position; | 1623 DCHECK(isEditablePosition(position)) << position; |
| 1615 if (position.isNull()) | 1624 if (position.isNull()) |
| 1616 return Position(); | 1625 return Position(); |
| 1617 | 1626 |
| 1618 if (isHTMLBRElement(*mostBackwardCaretPosition(position).anchorNode())) | 1627 if (isHTMLBRElement(*mostBackwardCaretPosition(position).anchorNode())) |
| 1619 return Position(); | 1628 return Position(); |
| 1620 | 1629 |
| 1621 const Position& prev = previousCharacterPosition(position, affinity); | 1630 const Position& prev = previousCharacterPosition(position, affinity); |
| 1622 if (prev == position) | 1631 if (prev == position) |
| 1623 return Position(); | 1632 return Position(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1639 : isCollapsibleWhitespace(previousCharacter); | 1648 : isCollapsibleWhitespace(previousCharacter); |
| 1640 if (!isSpace || !isEditablePosition(prev)) | 1649 if (!isSpace || !isEditablePosition(prev)) |
| 1641 return Position(); | 1650 return Position(); |
| 1642 return prev; | 1651 return prev; |
| 1643 } | 1652 } |
| 1644 | 1653 |
| 1645 // This assumes that it starts in editable content. | 1654 // This assumes that it starts in editable content. |
| 1646 Position trailingWhitespacePosition(const Position& position, | 1655 Position trailingWhitespacePosition(const Position& position, |
| 1647 TextAffinity, | 1656 TextAffinity, |
| 1648 WhitespacePositionOption option) { | 1657 WhitespacePositionOption option) { |
| 1658 DCHECK(!needsLayoutTreeUpdate(position)); |
| 1649 DCHECK(isEditablePosition(position)) << position; | 1659 DCHECK(isEditablePosition(position)) << position; |
| 1650 if (position.isNull()) | 1660 if (position.isNull()) |
| 1651 return Position(); | 1661 return Position(); |
| 1652 | 1662 |
| 1653 VisiblePosition visiblePosition = createVisiblePositionDeprecated(position); | 1663 VisiblePosition visiblePosition = createVisiblePosition(position); |
| 1654 UChar characterAfterVisiblePosition = characterAfter(visiblePosition); | 1664 UChar characterAfterVisiblePosition = characterAfter(visiblePosition); |
| 1655 bool isSpace = option == ConsiderNonCollapsibleWhitespace | 1665 bool isSpace = option == ConsiderNonCollapsibleWhitespace |
| 1656 ? (isSpaceOrNewline(characterAfterVisiblePosition) || | 1666 ? (isSpaceOrNewline(characterAfterVisiblePosition) || |
| 1657 characterAfterVisiblePosition == noBreakSpaceCharacter) | 1667 characterAfterVisiblePosition == noBreakSpaceCharacter) |
| 1658 : isCollapsibleWhitespace(characterAfterVisiblePosition); | 1668 : isCollapsibleWhitespace(characterAfterVisiblePosition); |
| 1659 // The space must not be in another paragraph and it must be editable. | 1669 // The space must not be in another paragraph and it must be editable. |
| 1660 if (isSpace && !isEndOfParagraph(visiblePosition) && | 1670 if (isSpace && !isEndOfParagraph(visiblePosition) && |
| 1661 nextPositionOf(visiblePosition, CannotCrossEditingBoundary).isNotNull()) | 1671 nextPositionOf(visiblePosition, CannotCrossEditingBoundary).isNotNull()) |
| 1662 return position; | 1672 return position; |
| 1663 return Position(); | 1673 return Position(); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1887 // TextIteratorEmitsCharactersBetweenAllVisiblePositions. | 1897 // TextIteratorEmitsCharactersBetweenAllVisiblePositions. |
| 1888 if (range.isNull()) | 1898 if (range.isNull()) |
| 1889 return VisiblePosition(); | 1899 return VisiblePosition(); |
| 1890 return createVisiblePosition(range.startPosition()); | 1900 return createVisiblePosition(range.startPosition()); |
| 1891 } | 1901 } |
| 1892 | 1902 |
| 1893 // Determines whether a node is inside a range or visibly starts and ends at the | 1903 // Determines whether a node is inside a range or visibly starts and ends at the |
| 1894 // boundaries of the range. Call this function to determine whether a node is | 1904 // boundaries of the range. Call this function to determine whether a node is |
| 1895 // visibly fit inside selectedRange | 1905 // visibly fit inside selectedRange |
| 1896 bool isNodeVisiblyContainedWithin(Node& node, const Range& selectedRange) { | 1906 bool isNodeVisiblyContainedWithin(Node& node, const Range& selectedRange) { |
| 1907 DCHECK(!needsLayoutTreeUpdate(node)); |
| 1908 DocumentLifecycle::DisallowTransitionScope disallowTransition( |
| 1909 node.document().lifecycle()); |
| 1910 |
| 1897 if (selectedRange.isNodeFullyContained(node)) | 1911 if (selectedRange.isNodeFullyContained(node)) |
| 1898 return true; | 1912 return true; |
| 1899 | 1913 |
| 1900 bool startIsVisuallySame = | 1914 bool startIsVisuallySame = |
| 1901 visiblePositionBeforeNode(node).deepEquivalent() == | 1915 visiblePositionBeforeNode(node).deepEquivalent() == |
| 1902 createVisiblePositionDeprecated(selectedRange.startPosition()) | 1916 createVisiblePosition(selectedRange.startPosition()).deepEquivalent(); |
| 1903 .deepEquivalent(); | |
| 1904 if (startIsVisuallySame && | 1917 if (startIsVisuallySame && |
| 1905 comparePositions(Position::inParentAfterNode(node), | 1918 comparePositions(Position::inParentAfterNode(node), |
| 1906 selectedRange.endPosition()) < 0) | 1919 selectedRange.endPosition()) < 0) |
| 1907 return true; | 1920 return true; |
| 1908 | 1921 |
| 1909 bool endIsVisuallySame = | 1922 bool endIsVisuallySame = |
| 1910 visiblePositionAfterNode(node).deepEquivalent() == | 1923 visiblePositionAfterNode(node).deepEquivalent() == |
| 1911 createVisiblePositionDeprecated(selectedRange.endPosition()) | 1924 createVisiblePosition(selectedRange.endPosition()).deepEquivalent(); |
| 1912 .deepEquivalent(); | |
| 1913 if (endIsVisuallySame && | 1925 if (endIsVisuallySame && |
| 1914 comparePositions(selectedRange.startPosition(), | 1926 comparePositions(selectedRange.startPosition(), |
| 1915 Position::inParentBeforeNode(node)) < 0) | 1927 Position::inParentBeforeNode(node)) < 0) |
| 1916 return true; | 1928 return true; |
| 1917 | 1929 |
| 1918 return startIsVisuallySame && endIsVisuallySame; | 1930 return startIsVisuallySame && endIsVisuallySame; |
| 1919 } | 1931 } |
| 1920 | 1932 |
| 1921 bool isRenderedAsNonInlineTableImageOrHR(const Node* node) { | 1933 bool isRenderedAsNonInlineTableImageOrHR(const Node* node) { |
| 1922 if (!node) | 1934 if (!node) |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2071 return InputType::DeleteWordBackward; | 2083 return InputType::DeleteWordBackward; |
| 2072 if (granularity == LineBoundary) | 2084 if (granularity == LineBoundary) |
| 2073 return InputType::DeleteLineBackward; | 2085 return InputType::DeleteLineBackward; |
| 2074 return InputType::DeleteContentBackward; | 2086 return InputType::DeleteContentBackward; |
| 2075 default: | 2087 default: |
| 2076 return InputType::None; | 2088 return InputType::None; |
| 2077 } | 2089 } |
| 2078 } | 2090 } |
| 2079 | 2091 |
| 2080 } // namespace blink | 2092 } // namespace blink |
| OLD | NEW |